Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / May 2005



Tip: Looking for answers? Try searching our database.

Creating boundaries for a game

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shillito - 31 May 2005 18:52 GMT
I have created my first game, but as it currently stands, you can move the
player off the screen forever to eternity. I would like to set it so that the
actual border 550x400 is the limit and the player cannot cross these
dimensions. How would I go about this?

Regards!
David Stiller - 31 May 2005 21:07 GMT
Shillito,

> I would like to set it so that the actual border 550x400 is the limit
> and the player cannot cross these dimensions. How would I go
> about this?

   Generally, you'll use an if() statement in the routine that causes your
player to move.  This routine presumably works in a frame loop (onEnterFrame
handler) or setInterval(), so while you're doing what it takes to update the
player's _x and _y properties, check their values to make sure they're no
smaller than zero and no greater than 550 or 400, respectively.

David
stiller (at) quip (dot) net
"Luck is the residue of good design."
Shillito - 31 May 2005 22:02 GMT
Thanks David.

I have now completed the actionscript and my first ever flash game, and it won't be the last. Thanks again.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.