Spawn X number of bubbles then move to position?

Get help using Construct 2

Post » Wed Dec 21, 2011 7:27 pm

whats the best way to spawn 10 little bubble(pre made art) at a object on collision, But after they spawn they move to a certain position??

You know in games, Where you collect a crystal so then it moves to the HUD? Kinda like that i guess..
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Wed Dec 21, 2011 7:33 pm


[code]Global variable xDestination = what you want
Global variable yDestination = what you want
Player: on Collision with Item
    -> Item: spawn bubble
system: every tick
    -> bubble: set X to lerp(self.x,xDestination,1-0.5^dt)
    -> bubble: set Y to lerp(self.y,yDestination,1-0.5^dt)[/code]
Should work.

If you want to spawn your bubbles on a HUD layer with different parallaxe values it's a bit different. Don't remember how to project coordinates through layers.Yann2011-12-21 19:36:32
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Dec 21, 2011 8:21 pm

Thanks @Yann !!! Yet again you never cease to amaze me!!

If i want to change the size of the object over time should i again use lerp?

something like:

system: every
lerp(self.width, targetScale,1*dt)
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Wed Dec 21, 2011 9:40 pm

yep do that for width and height
and it's more targetWidth and targetHeight (or targetSize if they have the same Width and Height) because a scale is a ratio between the new scaled width and the original width (:
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Dec 22, 2011 4:37 pm

Thanks @Yann,

you should have a signature,

"Yann, Making games better" :D:D:D
B
29
S
12
G
7
Posts: 740
Reputation: 7,849


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 18 guests