View Full Version : collision
keke
October 13th, 2004, 10:18 AM
i read through the tutorials but i cant get this thing to do the collison properly.
basically i have the "spaceship" movie clip controlled by the player and the walls called "enemy" (i have no idea why). anyways i want it so that if the spaceship hits the walls then it jumps back to its start position. If it makes it through the maze then it hits the "end" movie clip then i want it to say well done. How do i do this? I tried changing all the codes but i just got a page of errors.:*(
i started off putting it into the enemy actions(coz the spaceship one is full of how to move it and i have no idea where to stick the hittest code in)
so far i have:
onClipEvent (enterFrame) {
if (_root.enemy, hitTest(_root.spaceship)')' {
but i dont know how to put like "move spaceship to start position". i tried lots of things but i just get errors
i'd be so grateful if anyone could help
keke
October 13th, 2004, 07:33 PM
arghhh its driving me crazy with the syntax errors. should i just give up?
Moopers
October 13th, 2004, 08:07 PM
Try this:
onClipEvent(enterFrame){
if (_root.enemy.hitTest(_root.spaceship)){
_root.spaceship._x=(whatever you want);
_root.spaceship._y=(whatever you want);
}
}
keke
October 14th, 2004, 12:07 PM
Thanks soooo much. it works great.you have saved me
keke
October 14th, 2004, 03:33 PM
well here it is all finished. it sucks but its my first flash game so here http://www.geocities.com/cool_crew_2/spaceship.html
Dr Warm
October 15th, 2004, 03:43 AM
that's not that bad, played it a few times and couldn't finish it! keep it up
keke
October 23rd, 2004, 04:27 PM
arghh. i decided to make some more levels putting each level on a different keyframe. i want it so that when the goal(called end) collides with the spaceship it goes to the next keyframe. But wherever i put it in it just doesnt work. help i have this code so far for the end
onClipEvent(enterFrame){
if (_root.end.hitTest(_root.spaceship)){
_root.end._width =(300);
_root.end._height =(300);
_root.text = "YOU WIN! HOORAY FOR YOU";
} else {
_root.text = "Spinny Spaceships!";
}
}
pretty sure i dont need the rest of the stuff in there but if i try and edit it, nothing happens
TheOneAndOnly
October 23rd, 2004, 05:24 PM
onClipEvent(enterframe) {
if(this.hitTest(_root.circle)) {
_parent.nextFrame();
}
}
put that on the spaceship
hitman1131
October 24th, 2004, 12:06 AM
BAH. i played it a few times its alright huh. but i couldnt finnish it :(, kinda hard for a first stage :P
keke
November 1st, 2004, 04:20 PM
onClipEvent(enterframe) {
if(this.hitTest(_root.circle)) {
_parent.nextFrame();
}
}
put that on the spaceship
thank you soooo much. finally it works. you have no idea how many times i've seen that stupid error box
TheOneAndOnly
November 1st, 2004, 08:16 PM
hehe, no problem......i love your game simple yet so addicting.
signifer123
November 2nd, 2004, 08:09 AM
its too hard for me :(
icio
November 2nd, 2004, 02:26 PM
i did it :)
JoMan
November 2nd, 2004, 03:01 PM
well here it is all finished. it sucks but its my first flash game so here http://www.geocities.com/cool_crew_2/spaceship.html
How did you put your game in a web page? I want to do that with my game, but I dont know how.
Dr Warm
November 2nd, 2004, 07:36 PM
in flash you can say export to html, that's the simplest way, but if you've got dreamweaver its pretty simple also
icio
November 2nd, 2004, 09:03 PM
or notepad !! (notepad is pro)
Dr Warm
November 3rd, 2004, 12:18 AM
what do u put into notepad for an swf, i've become lazy with just using dreamweaver!
keke
November 4th, 2004, 04:36 PM
if you use pagebuilder on geocities you can just insert a for and script and put in the code from this page http://webmonkey.wired.com/webmonkey/01/10/index4a_page6.html?tw=multimedia
also if you use a site like freewebs it has an insert flash button which is very easy
bpalermo
November 5th, 2004, 11:27 AM
Nice game. Good one for a first. Mind if I make a few suggestions and point some bugs? Hope not...
Bugs:
+ Shouldn't ship hit also the game frame, that is, not being able to be part out of the screen?
+ After the player hits the circle, you should disable hitTesting. The way it is I could just keep on moving, after ending the game, and hit a wall, what takes me back to the begginning.
Suggestions:
+ Make an easier first stage.
+ Build other stages.
+ Give the player a time based score.
Hope it helps...
keke
November 6th, 2004, 12:06 PM
Nice game. Good one for a first. Mind if I make a few suggestions and point some bugs? Hope not...
Bugs:
+ Shouldn't ship hit also the game frame, that is, not being able to be part out of the screen?
+ After the player hits the circle, you should disable hitTesting. The way it is I could just keep on moving, after ending the game, and hit a wall, what takes me back to the begginning.
didn't know the code for making it not go out of the screen
i had no idea how to end the game so i just made it say you win at the top.
Suggestions:
+ Make an easier first stage.
+ Build other stages.
+ Give the player a time based score.
Hope it helps...
Done the first two already(making a sequal and so far i've got 6 stages)
Thanks for the help
icio
November 6th, 2004, 01:10 PM
if you open the files that you make in dreamweaver, with notepad, you'll see how to do it :)
Dr Warm
November 6th, 2004, 09:46 PM
Yeah i noticed that the other day, forgot to mention it on here, you just copy the exact same stuff
keke
November 19th, 2004, 04:07 PM
lol anyone want to help me with the code for if the spaceship is out the screen making it go back to the start. i had something like:
onClipEvent (enterFrame)
if (this.x= >0)
_root.spaceship._x=(102);
_root.spaceship._y=(317);
well its probably not what i had but after a day of actually doing some of my own coding i have now forgotten what it was. anyway it would work if i had like the x being less than 0 but then when i added the y being less then 0, the x becing more than 550 and the y being more then 400 then it wouldnt work. If anyone could help i'd be so grateful and yes everyone who has helped will be put into the credits
icio
November 19th, 2004, 06:50 PM
i'm sorry, but i actually hate that game... you should look at the advanced collisions tutorial on kirupa... the way you've it going just now sucks, because even if i don't hit the sides, i die...
take a look at this: http://www.kirupa.com/developer/actionscript/advanced_collision.htm
icio
November 19th, 2004, 06:51 PM
infact, take a look at this:
<iframe src="http://www.kirupa.com/developer/actionscript/advanced_collision.htm" />
:P
Dr Warm
November 19th, 2004, 09:39 PM
personally i don't like doing it that way, takes too long.............
but if you're feeling very adventurous, you can try the tutes here:
http://www.harveycartel.org/metanet/tutorials.html
but they're complicated!
keke
November 20th, 2004, 02:10 PM
i'm sorry, but i actually hate that game... you should look at the advanced collisions tutorial on kirupa... the way you've it going just now sucks, because even if i don't hit the sides, i die...
take a look at this: http://www.kirupa.com/developer/actionscript/advanced_collision.htm
actually you do hit the sides it just moves you back to the start before it shows the ship actually on the block.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.