-
XRave
Car Bondary! Game!
i am trying to create a basic driving game, but i got this problem with it's movements: The car just DRIVE OUT OF THE SCREEN!Dose anyone know how to make a MC that stops the car moving when it reaches the end of it's frame.
Last edited by tongxn; 10-03-2005 at 02:08 PM.
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Yes. It's possible. Try the "if" action and use the y/x variables to tell Flash to stop the MC when it gets to a certain x/y location. Sorry don't have the time to write the script right now....
-
XRave
but i really need to write the script.. anyway, just give me a tip on the main script
PLZPLZPLZPLZ
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Your Mom Is A Registered User
//before movement
last_x = _x
last_y = _y
//after movement
if (_x > 550) {
_x = last_x
}
if (_y > 400) {
_y = last_y
}
if (_x < 0) {
_x = last_x
}
if (_y < 0) {
_y = last_y
}
-
XRave
Maybe i should change that...
//before movement
last_x = _x
last_y = _y
//after movement
if (_x > 800) {
_x = last_x
}
if (_y > 600) {
_y = last_y
}
if (_x < 0) {
_x = last_x
}
if (_y < 0) {
_y = last_y
}
Is this right?
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
Em..where should i put the actionscript on? the car, the frame, or the background?
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
nope, that don't help, any other ideas about Hittest or something eles?
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
Ohh.. any other ideas???!
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Flash, Mans greatest invention
the script is right
you attach it to the main timeline
urm hitTest you could just to find if the car over laps something then use some kind of stop action but i would really suggest the script you were already given.
-
var x:Number = 1; x /= 0;
u can use hittest and have the action be that it moves in the opposite direction from the wall or whatever the same # as what the movement speed is...if u understood that
:]
-
XRave
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
will this work here as well?
http://www.ill-conceived.com/media/3...e-roomtst.html
I cant seem to get hitTest to keep me from walking thorugh the walls.
The walls are built out of a separeate class, where I can specify the size and # of sides (if this helps)
Let me know,
Thanks
-
XRave
Thanks for the idea, but i seem to make a 2D car game, and i don't get the idea about the roomtst?
Sory
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
I really thank the person who would give me the right answer though....
But it seemed no1 have the solution...
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Originally Posted by tongxn
Thanks for the idea, but i seem to make a 2D car game, and i don't get the idea about the roomtst?
Sory
I was asking how to get the code they supplied to work in that project. hitTest doesnt seem to work, this code may, but I havnt got it to yet.... any one know?
-
XRave
not me, and would u mind move that thread out of my Post?
Thank you.
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Flash, Mans greatest invention
You have been given the anwser over and over you just keep ignoring it
hitTest or simply make it so the cars x and y go past a certain position it goes in the reverse x/y
-
XRave
it don't work for me i think!
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Spaghetti-Code Extraordinaire
hittest would work if you say:
PHP Code:
z = movementSpeed;
if(car.hitTest(rightWall)){
car._x -= z;
}
if(car.hitTest(leftWall)){
car._x += z;
}
if(car.hitTest(topWall)){
car._y += z;
}
if(car.hitTest(bottomWall)){
car._y -= z;
}
This is just an idea of how i use hitTest to stop things. Hope this helps...
Last edited by hippofungus; 10-14-2005 at 03:55 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|