Grabbing sprites from other sprites

Get help using Construct 2

Post » Thu Jul 13, 2017 7:43 pm

Is there a way to get sprites to grab the image from another sprite? I think it would be useful to be able to do this for standarized death animations enemies and such.

Image
B
30
S
14
G
6
Posts: 29
Reputation: 5,507

Post » Thu Jul 13, 2017 8:28 pm

It's not advisable.
A: All instances of the same object use the same texture.
B: You would be increasing the memory use with something that's already in memory.
Image ImageImage
B
169
S
50
G
174
Posts: 8,327
Reputation: 110,798

Post » Thu Jul 13, 2017 8:52 pm

if you have an animation that is universal between objects, such as an explosion that occurs when you shoot any enemy or their health = 0, it may be helpful to make a seperate sprite of just the explosion animation, and spawn said sprite on the object when triggered, and once the animation is finished playing it destroys so as not to take up added memory or create lag.
this would look something like,
enemy; on enemy health =<0 ; enemy ; spawn object ; 'explosion animation'
; enemy; destroy

explosion animation; on created ; play animation 'Explode' from start

explosion animation; on animation 'explode' ended; 'explosion animation' ; destroy

you could disable collisions with the death animation so as once the enemy has died they cant hurt you, just be sure to spawn the animation onto the enemy before you destroy the enemy, or it will default and spawn the animation on all instances of the chosen sprite.
B
22
S
12
G
1
Posts: 108
Reputation: 2,774

Post » Thu Jul 13, 2017 10:07 pm

Speaking of explosions, just noticed the every tick.....
Image ImageImage
B
169
S
50
G
174
Posts: 8,327
Reputation: 110,798


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 41 guests