View Full Version : Help! Collision for maze game
shockwave
July 10th, 2002, 02:15 PM
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:
shockwave
July 10th, 2002, 03:06 PM
if you know any good tutorials, tell me. thanks :ninja: :pirate:
kornkid8281
July 10th, 2002, 03:58 PM
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
shockwave
July 10th, 2002, 09:43 PM
thanks man, it helped alot
shockwave
July 11th, 2002, 03:04 PM
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:
kornkid8281
July 11th, 2002, 07:11 PM
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!!!=)
shockwave
July 11th, 2002, 07:14 PM
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.
kornkid8281
July 11th, 2002, 07:17 PM
no problem, just don't forget to post up your game. i'd love to see it!
shockwave
July 11th, 2002, 07:31 PM
ok I will.
shockwave
July 11th, 2002, 07:42 PM
Can I just email you the .fla and can you fix the actionscript? not write, just like fix it, Im gettin alotta errors./
shockwave
July 11th, 2002, 07:54 PM
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
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.