How do I clone a Ball with same properties like the Original

Get help using Construct 2

Post » Sat Oct 18, 2014 9:18 pm

I have another problem with my Breakout Game.

I have setup a "Multiball" Powerup. The Ball are split and move when i collect them, but the new Ball does not have the same properties like the original Ball (it will spawn a normal ball)

Example: I have a Fireball as original Ball -> i collect the "Splitball Powerup", but the new (second) Ball are a Normalball.

Image

These are my Actions. Do anyone see the False? And how i can limit the maximal Balls on Screen?
B
8
S
2
Posts: 53
Reputation: 687

Post » Sat Oct 18, 2014 9:51 pm

Make sure your not setting the ball back to original in another event that is overwriting the changes being made here.

If only one type of ball can exist on screen at a time you could also make a global for each type and set it to 1 (and rest to 0) when that ball is active and then have your spawn only spawn the type set to 1, then reset when it changes.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Sun Oct 19, 2014 7:58 pm

Use the .AsJSON expression and "set from json" action to copy object state. Ex:

Global text temp=""

For each ball
---Set temp to ball.AsJSON
---ball: spawn ball at image point 0
---ball: Set form JSON string temp
B
91
S
31
G
102
Posts: 5,232
Reputation: 67,250

Post » Mon Oct 27, 2014 11:50 pm

Thank you @chrisfinger - your method work for me.
B
8
S
2
Posts: 53
Reputation: 687


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests