PDA

View Full Version : Gravity problem


Lui
06-13-2005, 04:06 AM
OK this gravity problem is annoying me,
see I've checked kirupa and all the other flash site but there wasnt a code that fitted the current code im using to move the ball

ok here's my code

onClipEvent(load){
speed=6
}
onClipEvent(enterFrame){
if(Key.isDown(Key.UP)){
_y -= speed
}
if(Key.isDown(Key.RIGHT)){
_x += speed
}
if(Key.isDown(Key.LEFT)){
_x -= speed
}
if(Key.isDown(Key.DOWN)){
_y += speed
}
if(hitTest(_root.wall)){
_y -= 0//right
_y += 6//left
}
}

I've added all the gravity codes to the parts where it was supposed to be placed in, but it breaks up and it doesnt work

can some one please add a gravity code in the code im using?

Bodadem
06-13-2005, 04:12 PM
onClipEvent (load) {
speed = 6;
gravity = 2;
speedy = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
_y -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.DOWN)) {
_y += speed;
}
if (hitTest(_root.wall)) {
_y -= 0;
//right
_y += 6;
//left
}
speedy = speedy+gravity;
this._y += speedy/5;
}


You're welcome.

eatmorchikin6464
06-13-2005, 05:39 PM
I don't think you are QUITE ready for gravity just yest. (Understatement)

Bodadem
06-13-2005, 06:34 PM
Don't be mean, Reid Harrison!

eatmorchikin6464
06-13-2005, 06:39 PM
I'm being honest, Garrett_Arnold@mac.com!

Bodadem
06-13-2005, 06:45 PM
He's perfectly ready for it, if he thinks he is.

eatmorchikin6464
06-13-2005, 06:51 PM
Well, I'm perfectly ready for you to come back to CSP. That doesn't mean you will.

Bodadem
06-13-2005, 07:02 PM
That's completely irrelevent.

eatmorchikin6464
06-13-2005, 07:05 PM
You know what is completely Irrelevent? The posts in Irrelevence. I don't like my tone Mr.

Lui
06-13-2005, 09:39 PM
thanks for the code bodadem

eatmorchikin6464
06-13-2005, 09:56 PM
Your welcome.

Bodadem
06-14-2005, 01:33 PM
You're welcome, lui.