admin管理员组文章数量:1313808
So basically I'm making an attack mechanic where the player character charges in the direction of the mouse, but I want for there to be a slight input delay and I'm thinking about doing that by checking if the attacking sprite has reached a certain frame. Is this acceptable? Here's my code:
//attacking
speed = attackvel
attackvel -= 0.1
attackvel = clamp(attackvel,0,10)
if attack and attackrecoil = false then
{
direction = point_direction(x,y,mouse_x,mouse_y)
attackvel = 50
attackrecoil = true
}
If this isn't efficient ill just use a timer but I don't really like using timers because I'm afraid they'll slow my game down.
So basically I'm making an attack mechanic where the player character charges in the direction of the mouse, but I want for there to be a slight input delay and I'm thinking about doing that by checking if the attacking sprite has reached a certain frame. Is this acceptable? Here's my code:
//attacking
speed = attackvel
attackvel -= 0.1
attackvel = clamp(attackvel,0,10)
if attack and attackrecoil = false then
{
direction = point_direction(x,y,mouse_x,mouse_y)
attackvel = 50
attackrecoil = true
}
If this isn't efficient ill just use a timer but I don't really like using timers because I'm afraid they'll slow my game down.
Share Improve this question asked Jan 31 at 4:05 paperboymanpaperboyman 133 bronze badges 1- Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Bot Commented Jan 31 at 6:49
1 Answer
Reset to default 1You can attach broadcast messages to your sprites! It's this button in the sprite view
This will dispatch a Broadcast Event that you'll be able to handle, check who's it for, and act accordingly.
版权声明:本文标题:game maker - is it acceptable to attach an action to a certain frame in a sprite? (Gamemaker) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741926903a2405343.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论