Solved

Flash Game Help

Posted on 2006-11-23
1
164 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
Action Script coding 1 191
Adobe flash player fails to install 12 329
Adobe Media Server Or Encoder Broken Affer Static IP Change 4 199
Flash Converter 8 142
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

740 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