Tried to search everywhere but it’s all click then the object shake themselves.
Trying to make the function that you have to drag with touchpad or mouse and shake left and right couple times at certain speed to put out a fire on the object.
Tried to search everywhere but it’s all click then the object shake themselves.
Trying to make the function that you have to drag with touchpad or mouse and shake left and right couple times at certain speed to put out a fire on the object.
There are a few ways you could do this. If you’re using physics, there’s a condition to check velocity in a direction.
You could also assign to a variable the objects X and Y coordinates as a player picks it up and check when the object is left/right of it.
Could also combine either of those with a timer that triggers on pickup if that needs to be relevant.
well it’s a game without physics so I guess it’s gonna be a little complicated? like movement have to be positive and negative on X during a certain time with certain speed…
Sounds like you’ll need to add a drag behaviour to the object and compare the current position of the cursor with it’s position in the previous frame. If the distance between the two points is greater than a set amount, then put out the fire.
Thx! I kinda understand the logic but how should I write the event to compare to the previous frame?
and I suppose this need to happen twice or more for positive and negative X movement? not sure how to write the if state if we need it happen couple times…?
Something like:
The first event is triggered once so it occurs whenever the drag first starts. The other drag event will check and update the old cursor position.
I added a variable fireAmount to the Fire object so it doesn’t “put out” the fire when the drag first starts, but will require a few back and forth swipes to get it extinguished.
Im trying to look for this condition on your screenshot
DIstanceBetweenPositions but can’t find it, is it some extension?
Thx!