PDA

View Full Version : help with an RPG game


Reginald
01-16-2004, 05:43 AM
Hello

I'm in the process of making a game.

The only problem is I need a universal way to detect hitTests to stop the guy from moving about but allow him to move the other. I need some help on how you guys do yours

if you need an example of what i mean check here (http://www.mettle-animation.com/game/blank.swf)



thanks

Johnny64
01-16-2004, 07:21 AM
Hoi

Like the game :D

Your problem...... can you show that your using because it looks all fine to me :D the hitTest ing


Edit: spalling :whistle:

junahu
01-16-2004, 07:29 AM
www.tonypa.pri.ee/tbw/tut06.html (http://www.tonypa.pri.ee/tbw/tut06.html)

tiles work apparently.

Reginald
01-16-2004, 07:46 AM
whoops, thats not my game, thats the kinda thing i want the game im making to me like

I need a way to detect the hitTesting like they have

Johnny64
01-16-2004, 10:26 AM
Originally posted by Reginald
Hello

I'm in the process of making a game.

The only problem is I need a universal way to detect hitTests to stop the guy from moving about but allow him to move the other. I need some help on how you guys do yours

if you need an example of what i mean check here (http://www.mettle-animation.com/game/blank.swf)



thanks

:blush: my bad

well i would use a hittest MovieClip

which would be behide the room drawing then you would only have to test one MC. you can add differend hittests for special things.
here is a example ;)

Reginald
01-16-2004, 10:32 AM
ahh cheers, nice one. I think i get it now

signifer123
05-11-2004, 06:59 PM
but how do you keep him from going through do you put so thast he goes -vel or somehting?

Marz
05-14-2004, 02:03 AM
To top the character from moving through. You would just use an offset number. Say.. Evertime you hit the left arrow key, your movieClip goes 10 pixels to the left. So.. if you run into a wall. You'll want to go back to the right 10 pixels.

Some pseudo code for you..


if(character runs into wall)
{
if(direction == left){ move character back right; }
if(direction == right){ move character back left; }
if(direction == top){ move character back down; }
if(direction == bottom){ move character back up; }
}


It's relatively simple to pull off. How to hitTest. I'd recommend using the tile based system.. Track which tile your character is currently on... then use a system of flags (0's or 1's) inside of a 3d array myArray[value][value] and then you can figure out if tit's passable or not passable.. If it is.. Allow the character to walk through, if not.. Stop him and perform the above operations.