How do I set scale to object scale

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • When sprite1 is changing scale from 0.1 to infinity and bullet hit sprite1, this sprite spawn another object explosion but explosion should be in this same scale as sprite1

    So if sprite1 (scale 0.1) is far away, explosion is small but if its closer (scale more than 0.1) explosion animation is bigger

  • You will need an instance variable in the sprite1 for CurrentSize=0, then set this variable to the scale of sprite1 when it is hit.

    Then all you need to do in your explosion spawn event is set the explosion size to CurrentSize... but make sure you haven't destroyed Sprite1 since your using an instance variable... just make sprite1 invisible while explosion happens and then destroy both sprite1 and explosion at same time... or use a global variable.. but if you have lots of sprite1-# you would need as many global variables if two would ever be destroyed at one time...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Set the scale of Explosion to Sprite1.Height/Sprite1.ImageHeight. This gives you the current scale of Sprite1.

  • blackhornet

    yes i do that before i set to sprite1 variable called 'size' and i pin this in events to always set scale to sprite1.size

    but if on screen i hit Sprite1 with scale 5 i receive 5x biggest explosion but if animation is not finished and i hit small sprite1, this big explosion will turned to this small size sprite1 and thats the problem

  • Your saying if one instance is large and explodes and another smaller instance is hit and explodes then the first instances explosion is set to the scale of the latter?

    This sounds like a "picking" issue.

    Make sure you condition out old sprite1 that are already exploding...

    maybe use an instance variable isExploding=0 then set to isExploding=1 at start of exploding animation, then use isExploding=0 to condition out old ones when creating new explosions...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)