How to make a sprite duplicate itself?

Get help using Construct 2

Post » Sat Sep 05, 2015 2:07 am

I want to make a sprite that gradually grows and split in 2 after 10 seconds...

Basically I was planing to do that by changing the scale of the sprite every tick, destroying it after 10 seconds, while at the same time, 2 new sprites spawn and loop the behavior from there. Anyone knows how I could do that?

The purpose is to make it behave in a similar way than living cells do.

UPDATE:
so far this is what I have to make the behavior

//this makes it grow
Every tick:
Plant: set height to Plant.Height+0.1
Plant: set width to Plant.Width+0.1

From here I'm thinking maybe I make it record the size of the height or width and once it gets to a precise number, I make it split in two or something?
Yeah it took a while but I think I figured most of it out.

If you are curious to see how it turned out: https://www.scirra.com/arcade/other-gam ... on=updated
Last edited by tenedria on Sat Sep 05, 2015 10:41 am, edited 1 time in total.
B
7
S
1
Posts: 6
Reputation: 1,641

Post » Sat Sep 05, 2015 7:20 am

Remember that computer number precision can catch the unwary, for instance, if you compare against a float, eg x = 2, it may not work, as the number may actually be 1.9999 recurring.

Much better would be to compare if a number is greater or lesser than a value, and try to control your values using the built-in expressions, such as Int, Ceiling, Floor, Round etc.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
132
S
29
G
81
Posts: 5,329
Reputation: 56,657


Return to How do I....?

Who is online

Users browsing this forum: AmpedRobot, SputnikCZ, Yahoo [Bot] and 2 guests