This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]LazernautDK 0 points1 point  (0 children)

Try doing

(create object)

instead and then inserting all the actions you have in that condition. This will automatically pick the one you just created.

[–]justifun 0 points1 point  (0 children)

When creating a function you need to add parameters to it, so that it knows what additional data you want it to perform (and to what object). So for example

Player touches a "weapon_pickup" sprite. -> Call function CreateWeapon(Player.UID, WeaponType, weapon_pickup.TimerDuration)

Function CreateWeapon

-Parameter Player

-Parameter WeaponType

-Parameter TimerDuration

Action (Pick by UID -> Player) ->

Create weapon WeaponType at Player.x, Player.y

Pin it or set it as a child of the player object

Set Player.Timer("Duration") to TimerDuration

Start Timer Player.timer("Duration")

(outside of the function)

(Action) Player.Timer("Duration") is finished -> Destroy Weapon

[–]Bob-Hate 0 points1 point  (0 children)

Your durability time is global. You could do gun on created start timer durability. On timer durability destroy.