TIRIX PLAYER PROGAMATION 0.1 - Atliy/Atliy GitHub Wiki

Welcome to tirix progamming!

TIRIX is being done by the "game maker studio 2" engine, so the programming will be formed by the language "game maker 2 language" so stay tuned.


player:

create

{

spd = 5; hspd = 0; vspd = 0; grv = 0.5; global.bullets = 5;

}

step:

{

#region CONTROLS

move_right = keyboard_check (ord ("D")); // move to right

move_left = keyboard_check (ord ("A")); // move to left

move_jump = keyboard_check (vk_space); // jump

key_shoot = mouse_check_button_pressed (mb_left); // shoot

#endregion

#region moves

var move = move_right - move_left

hspd = move * spd;

vspd = vspd + grv;

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

// horizontal collision

if place_meeting (x + hspd, y, o_colision)

{

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

} x = x + hspd

// vertical collision

if place_meeting (x, y + vspd, o_colision)

{

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

} y = y + vspd

// jump

if place_meeting (x, y + 1, o_colision) and move_jump

{ vspd - = 12 } #endregion

#region shoot

var flipped = direction;

var gun_x = (x + 4) * (flipped)

var _xx = x + lengthdir_x (15, image_angle)

var y_offset = lengthdir_y (-20, image_angle)

if key_shoot and global.bullets> 0 { audio_play_sound ([insert your sound here], 1.0)

with (instance_create_layer (_xx, y + 4, "shoot", o_shoot)) { global.bullets--; // bullet speed

speed = 20; // direction direction = -90 + 90 * other.image_xscale; //angle image_angle = direction; } }

#endregion

}