Solved

Flash Game Help

Posted on 2006-11-23
1
162 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I convert a CS4 FLA file to CS6? 1 871
how do I install adobe flash player on my ipad Air? 4 42
Removing Flash from Website 6 62
black magic design 1 128
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
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…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

785 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