Resize on spawn

0 favourites
  • 3 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • Hi guys,

    Given an object (a sprite) I added an event on the start of the layout to generate a few of these. The problem is that I want to generate them at different locations and different sizes. The location is easy as it's part of the create object parameters but how do you size the sprite instances at runtime? For example let's say my sprite is 32x32 and I want to generate 5 of this size and 5 at 64x64. I can't imagine I have to create two different sprites in my layout and generate each size separately. The create object doesn't give me back an ID or something so I really can get back to the object to set any properties except going through all of them.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Cant you use Instance Variables to keep track of each new Object as its spawned?

    for example....add a instance variable that tracks the Size of the object and the number of larger sized objects you want

    and then add an extra event that says...

    # of Spawned objects < 5 ..On Object Created/spawned

    -> Set size 64x64

    -> Add # of spawned 64x64 + 1


    once the number of 64x 64 is reached no more should spawn at that size..

    fairly straightforward

    and if you really need to lock it down...put a 'For Each'(object Spawned) condition in there as well....

  • mystazsea I thought about using instance variables and the On created event which looks like the only way to do it. However the example I gave wasn't really concrete enough.

    The sprites are blocks and there can be say 5 sizes (32x32, 32x64, 64x64, 128x32, and 128x64). Given a level I want to spawn a random number of each types. I thought I could create a single block (32x32) then spawn it and size it based on say a "blocksize" instance variable (which would be 0-4).

    For example:

    Level 1: 3@1, 2pnl@3

    This would produce 3 blocks sized to 32x64 and 2 blocks sized to 128x32.

    To set it up I use System => On start of layout and set the instance variable (blocksize) to 1 then spawned 3 objects then set it to 3 and spawned another 2 objects.

    Then I setup block On created with a condition when blocksize == 1 and the action to set the size of the block to 32x64.

    This didn't work as everything created is still the original size.

    Without having to create a different sprite for each size I'm not sure how I can do this.

    Why is setting the size on each instance dynamically so hard? I'm sure I'm doing something wrong here.


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