| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Dec 2001
Posts: 11
|
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. ![]() |
|
|
|
|
|
#2 |
|
The Placid Casual
Join Date: Oct 2001
Location: Malta
Posts: 1,026
|
Your best bet it using hittest.
SFA |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Apr 2002
Location: LA, CA
Posts: 12
|
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! |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FlashGameLicense.com - virtual marketplace to connect game developers and buyers | AdamSchroeder | General Chat | 0 | 12-18-2007 10:16 PM |
| Rate My Game, plz fill the questioner | UzumakiJr | Site Check | 0 | 12-16-2006 09:48 PM |
| Card Game (turn-based) - Lobby Room and Game Room, maintain state | cururu | ActionScript 2.0 | 3 | 05-20-2006 03:06 AM |
| currently developing a flash game | romainechester | ActionScript 1.0 (and below) | 5 | 11-19-2004 10:10 AM |
| [Help] Game Development | Ingage | ActionScript 2.0 | 2 | 10-24-2004 09:39 AM |