The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.34 / 5.00 31,296 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.07 / 5.00 10,082 ViewsHi, I'm trying to make a game. I got the main mechanics figured out, but here's my problem.
I have 2 movie clips. the first is a solid ball. The second is an open circle.I want to make it so when you control the open circle, the filled circle inside it reacts with gravity. Like a hamster in a ball.
Here's the code for the ball inside:
onClipEvent (load) {
ySpeed = 0;
// starting fall speed of object
gravity = 3;
// how fast the ySpeed rises, should be no higher then 3
bounce = .8;
// how much the speed decreases when for each bounce
ground = 350;
// where to bounce back
}
onClipEvent (enterFrame) {
if (_y<ground) {
ySpeed += gravity;
} else if (ySpeed>gravity*4) {
// change 4 to a higher number if it doesnt work
_y = ground;
ySpeed *= -bounce;
} else {
ySpeed = 0;
_y = ground;
}
_y += ySpeed;
}
Now this actully works, but it thinks the bottom of the browser is the ground. The rims of the circle is what I want it to stop at.I gave the circle the instance name "ground".
Can anyone help me?