# Help! Collision for maze game

**URL:** https://forum.kirupa.com/t/help-collision-for-maze-game/230
**Category:** flash
**Created:** [July 10, 2002, 6:15pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230 "2002-07-10T18:15:24Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![shockwave](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@shockwave](https://forum.kirupa.com/u/shockwave)
#### Post date: [July 10, 2002, 6:15pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/1 "2002-07-10T18:15:24Z")

</div>

```php
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:

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 10, 2002, 7:06pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/2 "2002-07-10T19:06:07Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 10, 2002, 7:58pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/3 "2002-07-10T19:58:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2002, 1:43am UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/4 "2002-07-11T01:43:57Z")

</div>

thanks man, it helped alot

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2002, 7:04pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/5 "2002-07-11T19:04:13Z")

</div>

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:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2002, 11:11pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/6 "2002-07-11T23:11:33Z")

</div>

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!!!=)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2002, 11:14pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/7 "2002-07-11T23:14:52Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2002, 11:17pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/8 "2002-07-11T23:17:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2002, 11:31pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/9 "2002-07-11T23:31:13Z")

</div>

ok I will.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2002, 11:42pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/10 "2002-07-11T23:42:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 11, 2002, 11:54pm UTC](https://forum.kirupa.com/t/help-collision-for-maze-game/230/11 "2002-07-11T23:54:45Z")

</div>

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
