how to make character place an ice block like this ?

0 favourites
  • 4 posts
From the Asset Store
Forgotten Place - Melodic ambiance, background music, Synth
  • how to make character place an ice block like this which lasts for 10 seconds and then gets destroyed ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you know how to create an object at runtime you're almost there...

    You will need an ice looking sprite object, and give it an instance variable (let's call it IceTimer) and give that a default value of 10 in the layout editor. This way, any ice block when created automatically has a value of 10 for the variable IceTimer.

    When you create the ice block (press button -> create ice.sprite) it will have our IceTimer value of 10.

    Now, you need an event that is [Every 1 seconds] as well as [Compare two values (ice.sprite.count is greater than 0)] with the action of "minus 1 from ice.sprite variable IceTimer"

    Finally one more event that is [Ice.sprite variable IceTimer=0] -> Destroy ice.sprite

    This would work for one ice sprite only (I think) - you may need to add some "for each ice.sprite" loops in the "every 1 seconds" event as well as the event that deletes the ice once the timer is at 0.

    Hopefully this makes sense.


  • fabionushi

    For creating the Ice, give the Player sprite an image point where you want the Ice sprite to be created and then whenever the command to spawn the ice is given, use the Spawn another object action

    Keyboard: On Space pressed -> Player: Spawn Ice on layer Player.LayerNumber (image point 1)

    For destroying the Ice after 10 seconds, here are a couple of alternative to what SoldjahBoy suggested:

    Option 1: Timer

    Give the Ice sprite the Timer behavior and destroy it when the Timer finishes

    Ice: On Created -> Ice: Start Timer "Melt" for 10.0 (Once)

    Ice: On Timer "Melt" -> Ice: Destroy

    Option 2: Fade

    Give the Ice sprite the Fade behavior, with the following settings:

    Active at Start = Yes

    Fade in time = 0

    Wait time = 9

    Fade out time = 1

    Destroy = After fade out

  • Yes I forgot about the timer behaviour... I never use it, and I probably should start actually using it, lol. Much easier than doing manual timers for a lot of stuff.

    Great work


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