31
Ask a Question / [Solved] Jump sound effect only while on ground
« on: December 20, 2018, 10:06:54 pm »
Just in case anyone is interested:
I figured out a much more simple solution than regions or collisions. I got to thinking that I would end up using way too many regions if I went with my previous solution, and I couldn't quite get collisions working, so I started thinking about actor Y speed. Here's what I came up with (it works great):
("On Ground" is a boolean game attribute)
When Scene is drawn
If Y speed of Actor = 0
Set On Ground to True
When Scene is updated
If On Ground = True
If Enter is pressed
Play sound
Set On Ground to False
Real simple. Still, thank you very much Luyren.
I figured out a much more simple solution than regions or collisions. I got to thinking that I would end up using way too many regions if I went with my previous solution, and I couldn't quite get collisions working, so I started thinking about actor Y speed. Here's what I came up with (it works great):
("On Ground" is a boolean game attribute)
When Scene is drawn
If Y speed of Actor = 0
Set On Ground to True
When Scene is updated
If On Ground = True
If Enter is pressed
Play sound
Set On Ground to False
Real simple. Still, thank you very much Luyren.