how to make character place an ice block like this ?

Get help using Construct 2

Post » Wed Aug 10, 2016 6:49 pm

Message: fabionushi can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
how to make character place an ice block like this which lasts for 10 seconds and then gets destroyed ?

http://prntscr.com/c431wa
B
4
Posts: 14
Reputation: 228

Post » Thu Aug 11, 2016 10:02 am

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.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Fri Aug 12, 2016 9:44 am

@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
Find all the Construct 2 games that were on Steam Greenlight here
B
36
S
10
G
7
Posts: 479
Reputation: 7,023

Post » Fri Aug 12, 2016 12:51 pm

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 :)

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests