• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Press applies randomly

N

Nexusrex

Guest
Hello guys. I've been working on a game where you control the character and that character can transform into another one by making a variable into true state and deactivating the main player. Now, when the character is into the extra one..And tries to get out. The player must move randomly. Is there any ideas on fixing this? Thanks
Here is the code for the extra character:
Code:
//Create event:
movespeed = 4;
jumpspeed = 8;

alive = false;

//Step event:

//Keys
keyjump = keyboard_check_pressed(vk_up);
keydisable = keyboard_check_released(vk_down);
keyleft = keyboard_check(vk_left);
keyright = keyboard_check(vk_right);
keyspecial = keyboard_check_pressed(vk_space);

//Gravity
if place_free(x,y+1)
{
gravity = 0.5;
gravity_direction = 270
}
else
{
gravity=0
gravity_direction = 270
}

//Movement
if alive = true
{
if keyleft
{
if place_free(x-movespeed,y)
{
image_xscale = -1;
x-=movespeed
}
}

if keyright
{
if place_free(x+movespeed,y)
{
image_xscale = 1;
x+=movespeed
}
}

if keyjump
{
if !place_free(x,y+jumpspeed)
{
vspeed=-jumpspeed
}
}
}

//Living or not
if alive = false
{
image_angle = 90;
}

if alive = true
{
image_angle = 0;
}

//Return into ghost
if keydisable
{
if alive = true
{
instance_activate_object(obj_pghost);
alive = false;
}
}

//Attacking
if keyspecial and alive = true
{
instance_create(x,y,obj_shot);
}

//Can't move
move_contact_solid(direction,12);
vspeed = 0;
Thanks in advance..Again.
 
N

Nexusrex

Guest
:\
Well, i mean..When i press the button. The code at the keypress of "keydisable" should happen. But, the player would need to move randomly then they can (randomly) do the code.
 
I

InkSho

Guest
er you can just set up an alarm to choose random actions until you don't need them to anymore
 
Top