Page 1 of 1
Rand x,y
Posted:
Sat Sep 01, 2007 4:53 am
by arcreamer
im working on a game and when the ball hits the player i want the ball to go flying up on the x and y axis but i want the x and y to be rand so it will go anywhere up... how would i do that??
Re: Rand x,y
Posted:
Sat Sep 01, 2007 7:08 am
by pixelpoop
to use random use rand(number).
so x=rand(3);
this can make x equal 0, 1, or 2
If your game is topdown I would recomend using direction with directional velocity.
angle=rand(360);
Re: Rand x,y
Posted:
Sat Sep 01, 2007 1:04 pm
by arcreamer
ok ill try that thanks!
Re: Rand x,y
Posted:
Sun Sep 02, 2007 1:01 am
by arcreamer
what i want to do is have it so when a ball hits the player the ball goes in any direction just as long as it goes up how would i do that?
Re: Rand x,y
Posted:
Sun Sep 02, 2007 2:29 am
by pixelpoop
is the camera looking straight down? so the ball goes up towards the camera and a little off to the side?
Re: Rand x,y
Posted:
Sun Sep 02, 2007 2:38 am
by arcreamer
ill give u a scrn...
Re: Rand x,y
Posted:
Sun Sep 02, 2007 2:51 am
by pixelpoop
So what I think you need is an extra animation of the ball getting bigger. So when the ball collides with the player the ball looks like it is rising towards the camera, then reverse that animation so it looks like it is falling back towards the ground. When it collides with the player you want a collision event that sets the directional_velocity, and angle.
directional_velocity=3;
angle=rand(360);
oooooops... I just realized I told you to set the direction is a previous post, but I should have told you to set the angle. Direction is read only. I will go back and edit my post.
Re: Rand x,y
Posted:
Sun Sep 02, 2007 3:28 am
by arcreamer
nevermind i got everything working right