8
82499
Guest
In my step event for my obj_player, I have written a code that moves it in 4 directions based on the arrow keys. I am currently using
if (keyboard_check(vk_right)) {
obj_player.x += spd;
sprite_index = spr_player_right;
image_speed = img_spd;
I am trying to remove
keyboard_check(vk_right) to be replaced with the local variable
var right_key = keyboard_check(vk_right)
The software just doesn't like the = sign in my variable. I have tried putting this as an instance variable but it still doesn't work. I am running Gamemaker 8.1 Lite. Does this change anything?
P.S. in the title, I was meant to say local variable.
if (keyboard_check(vk_right)) {
obj_player.x += spd;
sprite_index = spr_player_right;
image_speed = img_spd;
I am trying to remove
keyboard_check(vk_right) to be replaced with the local variable
var right_key = keyboard_check(vk_right)
The software just doesn't like the = sign in my variable. I have tried putting this as an instance variable but it still doesn't work. I am running Gamemaker 8.1 Lite. Does this change anything?
P.S. in the title, I was meant to say local variable.
Last edited by a moderator: