Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Flash Game Help

Posted on 2006-11-23
1
Medium Priority
?
172 Views
Last Modified: 2010-04-03
Hello all;

I am trying to make a simple soccer flash game. Currently the problem I have is that I need to make it so the main player cannot go off the screen.

What tool would I use with action script to prevent a object from going off the screen of the field/flash movie.

Any help appreciated. Thanks in advance.
0
Comment
Question by:dh-s
1 Comment
 
LVL 14

Accepted Solution

by:
trigger-happy earned 500 total points
ID: 18006931
you just have to put this kind of code on the player and let it execute everytime the player moves:

if(this._x < 0){
        this._x = 0;
}else if(this._x > 640){ //change 640 to the length of the flash screen in pixels
        this._x = 640;
}
if(this._y < 0){
        this._y = 0;
}else if(this._y > 480){ //change 480 to the height of the flash screen in pixels
        this._y = 480;
}

--trigger-happy
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to how to record live broadcast.
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question