C
chocolatehog
Guest
I recently started using game maker and have begun making a simple side scroller but am having trouble limiting the amount of jumps a character can make.
I tried to fix this problem on my own to no prevail.
Here is the code i am using for movement
var num limit = 0;
if place_meeting(x,y+1,obj_dirt_block) {gravity = 0}
else {gravity = 1}
if place_meeting(x,y+1,obj_grass_block) {gravity = 0}
else {gravity = 1}
if keyboard_check(vk_right) && place_free(x+1,y) {x+=5}
if keyboard_check(vk_left) && place_free(x-1,y) {x-=5}
if keyboard_check_pressed(vk_up) && limit = 0 {vspeed -= 10}
if keyboard_check_pressed(vk_up) && limit < 2 {limit += 1}
if place_meeting(x,y+1,obj_dirt_block) {limit = 0}
if place_meeting(x,y+1,obj_grass_block) {limit = 0}
any ideas?
I tried to fix this problem on my own to no prevail.
Here is the code i am using for movement
var num limit = 0;
if place_meeting(x,y+1,obj_dirt_block) {gravity = 0}
else {gravity = 1}
if place_meeting(x,y+1,obj_grass_block) {gravity = 0}
else {gravity = 1}
if keyboard_check(vk_right) && place_free(x+1,y) {x+=5}
if keyboard_check(vk_left) && place_free(x-1,y) {x-=5}
if keyboard_check_pressed(vk_up) && limit = 0 {vspeed -= 10}
if keyboard_check_pressed(vk_up) && limit < 2 {limit += 1}
if place_meeting(x,y+1,obj_dirt_block) {limit = 0}
if place_meeting(x,y+1,obj_grass_block) {limit = 0}
any ideas?