Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

if (distance_to_object(player) < 150 && life > 0)

mp_potential_step_object(player.x,player.y,spd,Wall)

delay--;
if (delay < 0) and (distance_to_object(player)<2)

{
global.vida--;
delay = 60;
}

///////////////////////////////////////////////////

if keyboard_check(ord("W")) & place_free(x,y-col){


y-=spd;
}

if keyboard_check(ord("A")) & place_free(x-col,y){


x-=spd;
}

if keyboard_check(ord("S")) & place_free(x,y+col){


y+=spd;
}

if keyboard_check(ord("D")) & place_free(x+col,y){


x+=spd;
}

if (global.vida = 0) {game_restart()};
if (global.vida = 0) {global.vida = 5};

////////////////////////////////////////////////////
if global.vida = 5{
draw_sprite(spr_vida,0,58,36)
}

if global.vida = 4{
draw_sprite(spr_vida,1,58,36)
}

if global.vida = 3{
draw_sprite(spr_vida,2,58,36)
}

if global.vida = 2{
draw_sprite(spr_vida,3,58,36)
}

if global.vida = 1{
draw_sprite(spr_vida,4,58,36)
}

if global.vida = 0{
draw_sprite(spr_vida,5,58,36)
}
/////////////////////////////////////////
var tiros = keyboard_check_pressed(vk_space);

if (tiros) {var t = instance_create_layer(x,y,layer,tiro);


t.speed = 10;
t.direction = face;
}

if (andarD) {face = 0};


if (andarE) {face = 180};
if (andarC) {face = 90};
if (andarB) {face = 270};

//////////////////////////////////////

if not instance_exists(target_) exit;


x = lerp(x, target_.x,0.1);
y = lerp(y, target_.y-height_/4, 0.2);
camera_set_view_pos(view_camera[0], x-width_/2,y-height_/2);

target_ = player;
width_ = camera_get_view_width(view_camera[0]);
height_ = camera_get_view_height(view_camera[0]);

////////////////////////////////////

draw_set_font(font1)
draw_set_color(c_white)

draw_text(x,y,"texto")

draw_text_transformed(x,y,"texto",1,1,0)

///////////////////////////////////
spd = 5;
hspd = 0;
vspd = 0;
grv = 0.4;

///////////////////////////////////
#region Controles

key_right = keyboard_check(vk_right);
key_left = keyboard_check(vk_left);

key_jump = keyboard_check(vk_space);

#endregion
#region Movimentação

var move = key_right - key_left;

hspd = move * spd;

vspd = vspd + grv;

if (hspd != 0) image_xscale = sign(hspd);

//Colisão Horizontal

if place_meeting(x+hspd,y,obj_chao)
{
while(!place_meeting(x+sign(hspd),y,obj_chao))
{
x = x + sign(hspd);
}
hspd = 0;
}

x = x + hspd;

//Colisão Vertical

if place_meeting(x,y+vspd,obj_chao)
{
while(!place_meeting(x,y+sign(vspd),obj_chao))
{
y = y + sign(vspd);
}
vspd = 0;
}

y = y + vspd;

//Pulo

if place_meeting(x,y+1,obj_chao) and key_jump


{
vspd -= 14;
}

#endregion

////////////////////////////////////////////////////////////

You might also like