PDA

View Full Version : [AS3] Top-Down game with scrollable background


Destini
12-17-2008, 04:18 PM
Hey,

Basically I'm trying to make a top-down game with a player in the center of the screen and a background which moves as the player moves (much like GTA1,2).

What I've currently built is a game which has a background MC and a player MC. The player MC is static in the center of the stage and doesn't move. The background however, moves as the user holds down an array key.

The problem is, how can I check if the player object collides with something within the background (map) such as a building.

If I do:

if(player.hitTestObject(map.building))

then it seems to check whenever the player hits the entire map, as opposed to just the building within the map.

I've seen this kind of game built many times, any suggestions?

Thanks for your help.

Darakan
12-17-2008, 04:20 PM
http://www.tonypa.pri.ee/tbw/tut13.html

Good guide for tile bases games, including scrollable

Destini
12-17-2008, 04:39 PM
That's very helpful thankyou :)

EightySeven
12-17-2008, 06:32 PM
If your looking for a non tile based system I have a code started you might want to look at, too large to put on here though

rrh
12-17-2008, 06:34 PM
hitTestObject does bounding-boxes, which is usually useless.
hitTestPoint is much more useful, in my experience.