Help! Collision for maze game

I need to know how to make it so ,in this maze game i'm making, the walls to keep the thingie from just going to the end. If anyone has a solution, please relpy! Thanks A lot! :ninja: :bandit:

if you know any good tutorials, tell me. thanks :ninja: :pirate:

here’s a nice .fla that might help you out. it uses an array in a matrix kinda manner. you’ll understand when you see it

thanks man, it helped alot

I got everything, pretty much, exept for I wanna make some traps, so I used the same script as I did for the exit:

  if (exit.hitTest(you._x, you._y, true) eq "true") {
	gotoAndStop (win);

I changed it to this:

if (spike1.hitTest(you._x, you._y, true) eq “true”) {
gotoAndStop (dead);

if (spike2.hitTest(you._x, you._y, true) eq “true”) {
gotoAndStop (dead);

if (spike3.hitTest(you._x, you._y, true) eq “true”) {
gotoAndStop (dead);

and so on. I know that I left out the {'s and }'s, but thats only in this reply, not the movie. It doesn’t work? Why not, the exit worked! Please help me someone! Thanks. =) :ninja: :asian:

hmmm… interesting.
perhaps if you try putting “_root” 's in there it might work like if instead of:

if (spike3.hitTest(you._x, you._y, true) eq “true”) {
gotoAndStop (“dead”);

you put:

if (spike3.hitTest(_root.you._x, _root.you._y, true) eq “true”) {
gotoAndStop (“dead”);

and by the way you don’t have to write out

“(spike3.hitTest(_root.you._x, _root.you._y, true) eq “true”)”

for an if statement, all ya gotta do is say
“(spike3.hitTest(_root.you._x, _root.you._y, true)”

p.s. please put up your game if you ever get it to work. i’ve been trying to put something cool together with it, but have been too lazy. it would be great if you could zip it up and post it!!!=)

Thanks A lot! I hope I’m not annoying anyone, but I’m pretty good in flash. I’ve been using flash for two years, since i was 10 and hope Im not to much of a newbie, anyway, thanks alot.

no problem, just don’t forget to post up your game. i’d love to see it!

ok I will.

Can I just email you the .fla and can you fix the actionscript? not write, just like fix it, Im gettin alotta errors./

I know i sound like an idiot, but I haven’t worked with actionscript as much as I have with just animating…So what’s this mean???

Output:
Scene=movie, Layer=player, Frame=1: Line 20: ‘{’ expected
if (maze.hitTest((you._x+5), you._y, true) ne “true”) {

Scene=movie, Layer=player, Frame=1: Line 36: Statement block must be terminated by ‘}’
if (spike4.hitTest(_root.you._x, _root.you._y, true) eq “true”) {

Scene=movie, Layer=player, Frame=1: Line 37: Syntax error.
gotoAndStop (2);

Scene=movie, Layer=player, Frame=1: Line 20: Statement block must be terminated by ‘}’
if (maze.hitTest((you._x+5), you._y, true) ne “true”) {

Scene=movie, Layer=player, Frame=1: Line 37: Syntax error.
gotoAndStop (2);

here’s the actionscript i got so far:

Seporator(not part of script)___________

on (keyPress “<Down>”) {
if (maze.hitTest(you._x, (you._y+5), true) ne “true”) {
setProperty (“you”, _y, (getProperty(you, _y))+5);
}
if (exit.hitTest(you._x, you._y, true) eq “true”) {
gotoAndStop (4);
}
}
on (keyPress “<Up>”) {
if (maze.hitTest(you._x, (you._y-5), true) ne “true”) {
setProperty (“you”, _y, (getProperty(you, _y))-5);
}
}
on (keyPress “<Left>”) {
if (maze.hitTest((you._x-5), you._y, true) ne “true”) {
setProperty (“you”, _x, (getProperty(you, _x))-5);
}
}
on (keyPress “<Right>”)
if (maze.hitTest((you._x+5), you._y, true) ne “true”) {
setProperty (“you”, _x, (getProperty(you, _x))+5);
}

if (spike1.hitTest(_root.you._x, _root.you._y, true) eq “true”) {
gotoAndStop (2);}

if (spike2.hitTest(_root.you._x, _root.you._y, true) eq “true”) {
gotoAndStop (2);}

if (spike3.hitTest(_root.you._x, _root.you._y, true) eq “true”) {
gotoAndStop (2);}

if (spike4.hitTest(_root.you._x, _root.you._y, true) eq “true”) {
gotoAndStop (2);

I NEED HELP ARRRRG.

:pirate:

thanks