GameMaker: Studio

GameMaker: Studio

轻松的查找、执行以及制作游戏
发现、评分并免费下载玩家用 GameMaker: Studio 制作的超棒游戏。或尝试创造属于您自己的游戏,并和社区分享。点击这里以了解更多。
jolb 2017 年 6 月 6 日 上午 8:47
im a little confused on SPRINTING.
ok so im trying to make the player have a sprint animation but the problem is that when i let go of the "sprint" key while holding down the walk key ("D" or "A"), the player is still in the sprint animation untill i let go of the "D" or "A" key... can anyone help?


if (left){
x -= hspd; // Hspd starts out as 1
image_xscale = -1; // Havent made a walking animation yet.

if (sprint == true){ // Sprint key
sprite_index = spr_player_sprint;
image_speed = .3;
hspd = 2;

}}else if (right){

x += hspd;
image_xscale = 1

if (sprint == true){
sprite_index = spr_player_sprint;
image_speed = .3;
hspd = 2;

}}else {

hspd = 1;
sprite_index = spr_player;
}







最后由 jolb 编辑于; 2017 年 6 月 6 日 上午 8:48
< >
正在显示第 1 - 2 条,共 2 条留言
melon king 4 2017 年 6 月 6 日 下午 3:13 
Is there anything that triggers to make sprint = false again?
surreal 1 2017 年 6 月 26 日 下午 12:27 
you should create a local var called sprinting;

var sprinting = keyboard_check(YOUR_SPRINT_KEY_HERE);

This will set sprinting to false when the key is not pressed.
< >
正在显示第 1 - 2 条,共 2 条留言
每页显示数: 1530 50