Skip to content

Commit

Permalink
Added hitscan lasers that rotate and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
billgan1024 committed Dec 13, 2020
1 parent 572b1f4 commit b93deed
Show file tree
Hide file tree
Showing 29 changed files with 417 additions and 448 deletions.
6 changes: 4 additions & 2 deletions game.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed game.zip
Binary file not shown.
229 changes: 0 additions & 229 deletions gamebackup.yyp

This file was deleted.

1 change: 1 addition & 0 deletions objects/oBullet/Collision_oCheckpoint.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
instance_destroy();
2 changes: 1 addition & 1 deletion objects/oGame/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ if(lx != xx || ly != yy)
{
instance_deactivate_layer("Enemies");
instance_deactivate_layer("Ground");
instance_deactivate_layer("Cannons");
instance_activate_region(xx, yy, 2560, 1440, true);
with(oBullet) instance_destroy();
with(oSpike) path_position = 0;
with(oSpikeBig) { path_position = 0; }
with(oHmovingPlatform) { x = xstart; y = ystart; platDir = platDirStart; }
with(oVmovingPlatform) { x = xstart; y = ystart; platDir = platDirStart; }
with(oBulletCannon) { alarm[0] = 30; }
with(oLaserCannon) { alarm[0] = 30; image_angle = angle; cannonState = 0; }
with(oUnstablePlatform)
{
unstable = false; image_xscale = 1; image_alpha = 1;
Expand Down
4 changes: 4 additions & 0 deletions objects/oLaserCannon/Alarm_0.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cannonState = (cannonState + 1) % 3;
if(cannonState == 2) { sound(snd_laser); image_index = 1; }
else image_index = 0;
alarm[0] = delay;
5 changes: 5 additions & 0 deletions objects/oLaserCannon/Create_0.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
delay = 60; angle = 0; alarm[0] = 30;
cannonState = 0; //0 = not doing stuff, 1 = about to fire, 2 = firing
rspd = 1;
laserWidth = 12;
t = 0;
13 changes: 13 additions & 0 deletions objects/oLaserCannon/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//laser stuff
var xx = lengthdir_x(12, image_angle);
var yy = lengthdir_y(12, image_angle);
if(cannonState == 2)
{
draw_line_width_color(x, y, c[1]+xx, c[2]+yy, laserWidth, c_red, c_red);
}
else if(cannonState == 1)
{
var col = make_colour_rgb(255, 204, 204);
draw_line_width_color(x, y, c[1]+xx, c[2]+yy, 9, col, col);
}
draw_self();
14 changes: 14 additions & 0 deletions objects/oLaserCannon/Step_0.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
image_angle += rspd; t += 1/60;
laserWidth = wave2(9, 12, 0.15, 0, t);
c = laser_collision(x, y, x+lengthdir_x(2560, image_angle), y+lengthdir_y(2560, image_angle), oGround, false, true);
//if the player is within the collision line, commit vaporize
if(cannonState == 2)
{
if(collision_line(x, y, c[1], c[2], oPlayer, false, true))
{
with(oPlayer)
{
event_perform(ev_collision, oEnemy);
}
}
}
41 changes: 41 additions & 0 deletions objects/oLaserCannon/oBulletCannon.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions objects/oLaserCannon/oLaserCannon.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion objects/oPersistent/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ else
//update values
update();
window_set_size(display_get_height()/3*4, display_get_height()/4*3);
alarm[1] = 1;
//alarm[1] = 1;

global.ps_above = part_system_create();
global.ps_below = part_system_create();
Expand Down
2 changes: 1 addition & 1 deletion objects/oPersistent/KeyPress_122.gml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if(alarm[0] == -1 && alarm[1] == -1)
if(alarm[0] == -1)
{
window_set_fullscreen(!window_get_fullscreen());
//alarm[0] = 30;
Expand Down
1 change: 0 additions & 1 deletion objects/oPersistent/oPersistent.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions objects/oPlayer/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ key_down = false;
key_up = false;
key_shift = global.isShifting;

yscale = 1;

if(global.loaded)
{
var xx = ds_map_find_value(oPersistent.levelData, "x");
Expand Down
4 changes: 2 additions & 2 deletions objects/oPlayer/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
draw_self();
//clr(c_black); ha(fa_center); fnt(fnt_small); txt(x, y-100, room);
draw_sprite_ext(sPlayer, 0, x, y, 1, yscale, 0, c_white, image_alpha);
//clr(c_black); ha(fa_center); fnt(fnt_small); txt(x, y-100, bbox_top -bbox_bottom);
8 changes: 6 additions & 2 deletions objects/oPlayer/Step_0.gml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
image_alpha = approach(image_alpha, 1, 0.1);
yscale = approach(yscale, 1, 0.05);
if(canMove) input();

move = key_right-key_left;
Expand Down Expand Up @@ -30,8 +31,8 @@ else

if(!onGround)
{
if(key_down && vsp >= -jumpSpeed) vsp = min(vsp+2*grav, maxGrav+3);
else vsp = min(vsp+grav, maxGrav);
if(key_down && vsp >= -jumpSpeed) { vsp = min(vsp+2*grav, maxGrav+3); }
else vsp = min(vsp+grav, maxGrav);
}

if(vsp < 0 && !key_up && !boosted) vsp += grav;
Expand All @@ -41,6 +42,7 @@ if(jumpBuffer > 0)
jumpBuffer--;
if(key_jump && vsp > -jumpSpeed)
{
yscale = 0.6;
sound(snd_jump);
boosted = false;
jumpBuffer = 0;
Expand All @@ -52,6 +54,7 @@ else if(extraJump)
{
if(key_jump && vsp >= -jumpSpeed)
{
yscale = 0.6;
sound(snd_jump);
boosted = false;
if(!place_meeting(x, y+10, oGround)) extraJump = false;
Expand Down Expand Up @@ -121,6 +124,7 @@ if(onGround) { extraJump = true; bonusJump = 0; boosted = false; jumpBuffer = 5;
var g = instance_place(x, y+1, oGround);
if(g != noone && g.object_index == oSpring)
{
yscale = 0.6;
sound(snd_bounce); vsp = -g.bounce; boosted = true;
g.image_index = 1; g.alarm[0] = 15;
}
Loading

0 comments on commit b93deed

Please sign in to comment.