Really great advice there guys, thanks a lot :)

I had my suspicions it would be done like this, but needed to be reassured by the Ninja's.

Luckily the game logic is separated from the display, in a similar way to how you're describing. I currently have multiple scrolling engines, each representing a layer of parallax. I'm guessing I just need to duplicate a single 'terrain' scrolling engine (which is never actually drawn) and combine it with the necessary collision detection for each baddy that needs AI.

Cheers folks!

J



Joshua Sera wrote:
Separate your display code from your game logic.

One thing that I see frequently is people inheriting
directly from movie clips for their game objects. This
is bad because it encourages overuse of inheritance,
and makes display/game logic separation harder.

Usually, I'll have my game object as separate items,
with their own x and y properties, then a viewport
object for determining where you're looking. To
determine what gets displayed, I'll check to see if
the game object is within half a screen distance from
the viewport, and if it is, and not already displayed,
I'll attach a new movieclip, and position it relative
to the screen center by the distance from the viewport
to the game object.




--- James Marsden <[EMAIL PROTECTED]> wrote:

Hello all,

When building a game where collision detection for
enemies is important (such as a scrolling tile game), how do you create persistent AI for an enemy when it's off-screen?

For example, walking away from the enemy causes it
to be removed from the game area, but the enemy needs to keep wandering around the world in virtual terms, so the player can't easily tell where the enemy is going to be when returning to the same area. How do you maintain that interaction for the enemy, or is it not done like that because it's too processor intensive?

Any tips or pointers to resources would be much
appreciated.

Thanks!

James
_______________________________________________
[email protected]
To change your subscription options or search the
archive:

http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to