gmc-jam-7/objects/obj_player/Step_0.gml

113 lines
2.2 KiB
Plaintext
Executable File

global.invuln -= 1
if !instance_exists(obj_talker)
{
score += 10
}
right = keyboard_check(vk_right)
left = keyboard_check(vk_left)
up = keyboard_check(vk_up)
down = keyboard_check(vk_down)
prevdir = direction
if right
direction = 0
if up
direction = 90
if left
direction = 180
if down
direction = 270
if up and right
direction = 45
if up and left
direction = 135
if down and left
direction = 225
if down and right
direction = 315
if prevdir != direction
{
if not((direction >= 315 and prevdir <= 20) or (direction <= 20 and prevdir >= 315))
{
chargeup = (180-(abs(prevdir-direction)))/180
}
else
{
if (direction >= 315 and prevdir <= 20)
chargeup = (180-(abs((prevdir+180)-(direction-180))))/180
if (direction <= 20 and prevdir >= 315)
chargeup = (180-(abs((prevdir-180)-(direction+180))))/180
}
}
if chargeup < 1
chargeup += .2
if chargeup > 1
chargeup = 1
if up or down or left or right
speed = 10 * chargeup
else
chargeup = 0
if x > 750
x = 750
if x < 50
x = 50
if y > 550
y = 550
if y < 100
y = 100
if keyboard_check_pressed(ord("C"))
{
if global.ldmode
{
global.ldmode = 0
}
else
{
global.ldmode = 1
}
}
if keyboard_check(ord("Z")) and global.talking = 0
{
volley = 3
}
tapped += 1
if volley > 0 and tapped >= 2
{
sound_play(snd_shooting)
instance_create(x-10,y,obj_shot)
instance_create(x,y,obj_shot)
instance_create(x+10,y,obj_shot)
iii = instance_create(x-10,y,obj_shot)
with (iii)
{
direction = 100
speed = 10
}
iii = instance_create(x+10,y,obj_shot)
with (iii)
{
direction = 80
speed = 10
}
volley -= 1
tapped = 0
}
global.charged += .1
if global.charged > 100
global.charged = 100
if global.charged >= 25 and keyboard_check_pressed(ord("X")) and !instance_exists(obj_bomber)
{
sound_play(snd_bomblayer1)
sound_play(snd_bomblayer2)
sound_play(snd_bomblayer3)
instance_create(x,y-50,obj_bomber)
global.charged -= 25
}