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:
Thanks in advance..Again.
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;