PDA

View Full Version : help on developing my game.


fastzone
12-27-2001, 12:46 PM
:confused:
Hi, I need help on this question. I am making a game that allow a player to go around a 2D map (Something like pac-man), and the player has to collect some items and bring it to a location to complete the game. The problem is that from the books that I readed, it uses MC that is not visible to set the locations that the player can go. But I don't want to do this since I am not making another pac-man like game where the map is fill with items. In my game, the items is place randomly (it will not cover the whole map), and there is walls to block the player. So the player must not be able to go through the walls but still be able to go and collect the items. I really hope that anyone can teach me how to do it cause I had no ideal how to do it at all.
:confused:

sfa
12-27-2001, 01:24 PM
Your best bet it using hittest.

SFA

Drewmutt
04-19-2002, 10:17 PM
Hi! I just got done making Pacman (what a freakin' week). Anywho, the method I used was a two dimensional array.
The values that were '0' were blank.
1 was a wall
2 was a dot
... so on.

Also, the big dots (or questions, per the revised version of the rules) were random. The way I achived that was a for loop that made a new list of the X and Y of the big dots.
For instance my map 2d array would be:
11111111
10010011
10210011
11010211
and so on...

My big dot array would be:
BDots[1]={3,3}
BDots[2]={6,4}

My questions were in a different array. So, I could use the index of those questions as markers in my map array.

Let's say we didn't care about redundancy (if we did, another array would be used to tell us what indicies we have used so far)

Map[BDots[1][1], BDots[1][2]]=int(random(2)+2)
Map[BDots[2][1], BDots[2][1]]=int(random(2)+2)

That would assign a random number between 3 and 4 to each of those x and y coords of where we found the 2's. Yes, a for loop could be used if you had a a lot more, and yes int is depreciated in Flash MX, they want Math.int() now.

Now, finally, to your question. What about the walls. It's simple, given the direction they are going, if the next one would be a 1 in the array, stop the movement. I also had evil guys that ran around, but I used hit test for them. The great thing about the 2d array is that you can EASILY make new levels, or move stuff around.

I know this got kinda wordy, but I needed to vent.

Hope it helps you out!