• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Flash Game Help

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
dh-s
Asked:
dh-s
1 Solution
 
trigger-happyCommented:
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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now