How do I make balls to be "juggled" ?

Get help using Construct 2

Post » Fri Apr 11, 2014 11:33 am


it's an enemy juggling 4 balls at the same time. How to code the movement of the balls?

Note: there are supposed to be multiple instances of the juggler enemy.
Posts: 301
Reputation: 2,736

Post » Fri Apr 11, 2014 3:24 pm

Not sure if it would look good, but based on the picture shown, you could try making an orbital movement.

You will need:

-Origin point //Image point on the enemy ( user for the ball to orbit around)
-variable Angle
-variable Speed
-variable Radius

On an every tick event position the ball using the following:

local variable "rad"(radians) = angle * (Math.PI / 180) // here we convert the angle to radians
ball> set X> origin.x + radius * Math.cos(rad)
ball> set Y> origin.y + radius * Math.sin(rad)

angle > add value > speed // the angle variable is what defines the position of the ball..if you don't increase it the ball won't move


Another try, sync 2 sines behaviours, one horizontal and one vertical, could also give you this effect.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
Posts: 272
Reputation: 1,643

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests