diff --git a/Spaceinator.project.gmx b/Spaceinator.project.gmx
index b753b55..2305a25 100644
--- a/Spaceinator.project.gmx
+++ b/Spaceinator.project.gmx
@@ -18,11 +18,18 @@
sprites\spr_asteroid
sprites\spr_boom
sprites\spr_chunk
+
+ sprites\spr_gameover
+ sprites\spr_button
+
background\bg_space
+
+
+
@@ -32,6 +39,11 @@
+
+
+
+
+
rooms\rm_game
diff --git a/objects/obj_asteriod.object.gmx b/objects/obj_asteriod.object.gmx
index 783f7f4..f0cf1a9 100644
--- a/objects/obj_asteriod.object.gmx
+++ b/objects/obj_asteriod.object.gmx
@@ -30,7 +30,33 @@ image_index = random_range(0,1);
angle = random_range(0,180);
direction = angle;
image_angle = angle;
-
+//speed = 1;
+
+
+
+
+
+
+
+ 1
+ 603
+ 7
+ 0
+ 0
+ -1
+ 2
+
+
+ self
+ 0
+ 0
+
+
+ 1
+ if(speed > 0)
+{
+ speed -= 1
+}
diff --git a/objects/obj_boom_fx.object.gmx b/objects/obj_boom_fx.object.gmx
index 7a3806b..83ffb90 100644
--- a/objects/obj_boom_fx.object.gmx
+++ b/objects/obj_boom_fx.object.gmx
@@ -3,7 +3,7 @@
spr_boom
0
-1
- -60
+ -200
0
<undefined>
<undefined>
diff --git a/objects/obj_bullet.object.gmx b/objects/obj_bullet.object.gmx
index 853247e..313265f 100644
--- a/objects/obj_bullet.object.gmx
+++ b/objects/obj_bullet.object.gmx
@@ -51,7 +51,7 @@ image_speed = 0;
1
step_counter ++;
-if(step_counter == 60*room_speed)
+if(step_counter == 60*room_speed || instance_position(x,y,obj_chunk) == noone)
{
instance_destroy(self);
}
diff --git a/objects/obj_button.object.gmx b/objects/obj_button.object.gmx
new file mode 100644
index 0000000..50138c2
--- /dev/null
+++ b/objects/obj_button.object.gmx
@@ -0,0 +1,94 @@
+
+
diff --git a/objects/obj_chunk.object.gmx b/objects/obj_chunk.object.gmx
index 4d8b132..7317d8c 100644
--- a/objects/obj_chunk.object.gmx
+++ b/objects/obj_chunk.object.gmx
@@ -34,10 +34,10 @@ for(var xx = 0; xx < CHUNK_SIZE*TILE_SIZE; xx+= TILE_SIZE)
{
for(var yy = 0; yy < CHUNK_SIZE*TILE_SIZE; yy+= TILE_SIZE)
{
- if(random_range(0,100) < 5)
+ if(random_range(0,100) < 1)
{
var inst = instance_create(x+xx,y+yy, obj_asteriod);
- inst.CHUNK_CONTAINED = id;
+ inst.CHUNK_CONTAINED = self.id;
ds_list_add(instance_list, inst);
}
diff --git a/objects/obj_chunk_item.object.gmx b/objects/obj_chunk_item.object.gmx
index 6fcb0b3..5b86845 100644
--- a/objects/obj_chunk_item.object.gmx
+++ b/objects/obj_chunk_item.object.gmx
@@ -27,6 +27,38 @@
1
var indx = ds_list_find_index(CHUNK_CONTAINED.instance_list,id);
ds_list_delete(CHUNK_CONTAINED.instance_list,indx);
+
+
+
+
+
+
+
+ 1
+ 603
+ 7
+ 0
+ 0
+ -1
+ 2
+
+
+ self
+ 0
+ 0
+
+
+ 1
+ var curChunk = instance_position(x,y,obj_chunk);
+if(curChunk != CHUNK_CONTAINED && curChunk != noone)
+{
+ show_debug_message("Moving chunks.");
+ var indx = ds_list_find_index(CHUNK_CONTAINED.instance_list,id);
+ ds_list_delete(CHUNK_CONTAINED.instance_list,indx);
+
+ CHUNK_CONTAINED = curChunk;
+ ds_list_add(curChunk.instance_list,id);
+}
diff --git a/objects/obj_controller.object.gmx b/objects/obj_controller.object.gmx
index 3011a0f..cc656ee 100644
--- a/objects/obj_controller.object.gmx
+++ b/objects/obj_controller.object.gmx
@@ -25,14 +25,13 @@
1
- step_counter = 0;
-global.debug = false
+ global.debug = false
-
+
1
603
@@ -49,14 +48,21 @@ global.debug = false
1
- /// Every Frame Global Code.
-step_counter++;
+ /// Draw HUD
+
+if(!global.debug)
+{
+ draw_set_color(c_white);
+ draw_healthbar(10,10,500,30,(obj_player.energy/obj_player.energy_max)*100,c_gray,c_yellow,c_blue,0,true,false);
+ draw_text(11,13,string(obj_player.energy)+" / "+string(obj_player.energy_max));
+
+ draw_healthbar(10,40,300,60,(obj_player.hp/obj_player.hp_max)*100,c_gray,c_red,c_green,0,true,false);
+ draw_text(11,43,string(obj_player.hp)+" / "+string(obj_player.hp_max));
+}
-
-
1
603
@@ -112,6 +118,7 @@ if(chunkX == 0 && (playX < 0 && playX >= chunk_total_size/
draw_text(10,10,"X: "+string(obj_player.x)+"#Y: "+string(obj_player.y));
draw_text(10,40,"CrX: "+string(chunkRelX)+"#CrY: "+string(chunkRelY));
draw_text(10,70,"CX: "+string(chunkX)+"#CY: "+string(chunkY));
+draw_text(10,100,"Invuln: "+string(obj_player.invuln_counter));
}
diff --git a/objects/obj_gameover_overlay.object.gmx b/objects/obj_gameover_overlay.object.gmx
new file mode 100644
index 0000000..805b405
--- /dev/null
+++ b/objects/obj_gameover_overlay.object.gmx
@@ -0,0 +1,23 @@
+
+
diff --git a/objects/obj_player.object.gmx b/objects/obj_player.object.gmx
index 75f2189..eaf8c56 100644
--- a/objects/obj_player.object.gmx
+++ b/objects/obj_player.object.gmx
@@ -28,7 +28,16 @@
/// Player creation code.
image_speed = 0;
image_index = 1;
+is_moving = false;
+dead = false;
+invuln_counter_max = 1*room_speed;
+invuln_counter = invuln_counter_max;
+energy_max = 500;
+energy = energy_max
+
+hp_max = 100;
+hp = hp_max;
@@ -52,16 +61,112 @@ image_index = 1;
1
/// Player per frame
+if(dead == true)
+{
+ return 0;
+}
+
+if(hp <= 0)
+{
+ speed = 0;
+ direction = 0;
+
+ audio_stop_all();
+ audio_play_sound(snd_boom,10,false);
+ sprite_index = spr_boom;
+ image_speed = 1;
+ hp = -1;
+ dead = true
+}
+
direction = image_angle
+
+if(speed < 0)
+{
+ speed += 1;
+}
if(speed > 0)
+{
speed -= 1
-
-if(speed > 20)
- speed = 20;
-
+}
+
+if(energy >= 10 && is_moving && keyboard_check(vk_shift))
+{
+ if(speed > 30)
+ {
+ speed = 30;
+ }
+ energy -= 10;
+}
+else
+{
+ if(speed > 20)
+ {
+ speed = 20;
+ }
+}
+
view_xview[0] = x - view_wview[0]/2;
view_yview[0] = y - view_hview[0]/2;
+
+if(!is_moving)
+{
+ if(energy < energy_max)
+ {
+ energy += 5;
+ }
+}
+
+if(invuln_counter == invuln_counter_max)
+{
+ visible = true;;
+}
+
+if(invuln_counter != invuln_counter_max)
+{
+ if(invuln_counter % 5 == 0)
+ {
+ visible = !visible;
+ }
+ invuln_counter ++;
+}
+
+
+
+
+
+
+
+
+
+ 1
+ 603
+ 7
+ 0
+ 0
+ -1
+ 2
+
+
+ self
+ 0
+ 0
+
+
+ 1
+ damage_player(5);
+
+instance_create(other.x,other.y,obj_boom_fx);
+other.direction = direction;
+other.image_angle = image_angle;
+other.speed = 20;
+
+speed = -20;
+
+
+
+
@@ -84,7 +189,12 @@ view_yview[0] = y - view_hview[0]/2;
1
- direction = image_angle
+ if(dead == true || speed < 0)
+{
+ return 0;
+}
+
+direction = image_angle
speed += 5
@@ -109,7 +219,12 @@ speed += 5
1
- image_angle -= 5;
+ if(dead == true)
+{
+ return 0;
+}
+
+image_angle -= 5;
@@ -132,7 +247,12 @@ speed += 5
1
- image_angle += 5;
+ if(dead == true)
+{
+ return 0;
+}
+
+image_angle += 5;
@@ -155,11 +275,54 @@ speed += 5
1
- var new_bullet = instance_create(x,y,obj_bullet);
-audio_play_sound(snd_shoot,2,false);
-new_bullet.image_angle = image_angle;
-new_bullet.direction = image_angle;
-new_bullet.speed = speed + 5;
+ if(dead == true)
+{
+ return 0;
+}
+
+
+if(energy >= 20)
+{
+ var new_bullet = instance_create(x,y,obj_bullet);
+ audio_play_sound(snd_shoot,2,false);
+ new_bullet.image_angle = image_angle;
+ new_bullet.direction = image_angle;
+ new_bullet.speed = speed + 5;
+ energy -= 20;
+}
+
+
+
+
+
+
+
+
+ 1
+ 603
+ 7
+ 0
+ 0
+ -1
+ 2
+
+
+ self
+ 0
+ 0
+
+
+ 1
+ if(dead == false)
+{
+ return 0;
+}
+
+obj_controller.visible = false;
+image_speed = 0;
+visible = false;
+instance_create(view_xview[0]+(view_wview[0]/2),view_yview[0]+(view_hview[0]/2),obj_gameover_overlay);
+instance_create(view_xview[0]+(view_wview[0]/2),view_yview[0]+(view_hview[0]/2),obj_respawn);
@@ -183,7 +346,13 @@ new_bullet.speed = speed + 5;
1
- audio_play_sound(snd_engine,1,true);
+ if(dead == true)
+{
+ return 0;
+}
+
+is_moving = true;
+audio_play_sound(snd_engine,1,true);
image_index = 0;
@@ -207,7 +376,13 @@ image_index = 0;
1
- audio_stop_sound(snd_engine)
+ if(dead == true)
+{
+ return 0;
+}
+
+is_moving = false;
+audio_stop_sound(snd_engine)
image_index = 1;
diff --git a/objects/obj_respawn.object.gmx b/objects/obj_respawn.object.gmx
new file mode 100644
index 0000000..de93cd8
--- /dev/null
+++ b/objects/obj_respawn.object.gmx
@@ -0,0 +1,111 @@
+
+
diff --git a/scripts/damage_player.gml b/scripts/damage_player.gml
new file mode 100644
index 0000000..823b677
--- /dev/null
+++ b/scripts/damage_player.gml
@@ -0,0 +1,8 @@
+///damage_player(amount)
+
+if(invuln_counter == invuln_counter_max)
+{
+ hp -= argument0;
+ invuln_counter = 0;
+}
+
diff --git a/sprites/images/spr_button_0.png b/sprites/images/spr_button_0.png
new file mode 100644
index 0000000..2958f0c
Binary files /dev/null and b/sprites/images/spr_button_0.png differ
diff --git a/sprites/images/spr_button_1.png b/sprites/images/spr_button_1.png
new file mode 100644
index 0000000..d8b0521
Binary files /dev/null and b/sprites/images/spr_button_1.png differ
diff --git a/sprites/images/spr_gameover_0.png b/sprites/images/spr_gameover_0.png
new file mode 100644
index 0000000..e8f3a21
Binary files /dev/null and b/sprites/images/spr_gameover_0.png differ
diff --git a/sprites/images/spr_respawn_0.png b/sprites/images/spr_respawn_0.png
new file mode 100644
index 0000000..e9d0132
Binary files /dev/null and b/sprites/images/spr_respawn_0.png differ
diff --git a/sprites/spr_button.sprite.gmx b/sprites/spr_button.sprite.gmx
new file mode 100644
index 0000000..1f1ffc7
--- /dev/null
+++ b/sprites/spr_button.sprite.gmx
@@ -0,0 +1,26 @@
+
+
+ 0
+ 200
+ 16
+ 1
+ 0
+ 0
+ 0
+ 0
+ 399
+ 0
+ 31
+ 0
+ 0
+
+ 0
+
+ 0
+ 400
+ 32
+
+ images\spr_button_0.png
+ images\spr_button_1.png
+
+
diff --git a/sprites/spr_gameover.sprite.gmx b/sprites/spr_gameover.sprite.gmx
new file mode 100644
index 0000000..ab953b7
--- /dev/null
+++ b/sprites/spr_gameover.sprite.gmx
@@ -0,0 +1,25 @@
+
+
+ 0
+ 960
+ 540
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1919
+ 0
+ 1079
+ 0
+ 0
+
+ 0
+
+ 0
+ 1920
+ 1080
+
+ images\spr_gameover_0.png
+
+