Solved

Flash Game Help

Posted on 2006-11-23
1
160 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 125 total points
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now