Commit bde442ee authored by Ulises Gaytan's avatar Ulises Gaytan 💬

Code complete

parent 6937aa46
......@@ -54,6 +54,14 @@
"resourceType": "GMSprite"
}
},
{
"Key": "13a5675e-c622-4b73-8054-db9e3e96138d",
"Value": {
"id": "76802290-f0fb-4a04-bdde-9f8a22c392f9",
"resourcePath": "sounds\\msc_music\\msc_music.yy",
"resourceType": "GMSound"
}
},
{
"Key": "142e8e41-05f2-474d-8f20-8ec5a467b6dc",
"Value": {
......@@ -150,6 +158,14 @@
"resourceType": "GMFolder"
}
},
{
"Key": "3b12ce81-b522-450d-bd2b-93ee717fb03d",
"Value": {
"id": "25db0307-8285-4392-86be-1deff4bd66be",
"resourcePath": "rooms\\rm_story\\rm_story.yy",
"resourceType": "GMRoom"
}
},
{
"Key": "42afee09-47ea-4edc-9d12-6dde353abae3",
"Value": {
......@@ -166,6 +182,14 @@
"resourceType": "GMObject"
}
},
{
"Key": "5061ef23-6e8e-43e1-9c3e-1be1a22a3ca4",
"Value": {
"id": "9abd5f58-4422-4922-a38d-7dc0367aaf8a",
"resourcePath": "sprites\\spr_trail\\spr_trail.yy",
"resourceType": "GMSprite"
}
},
{
"Key": "51b0e11f-3081-46ec-81d6-a43f2da287a8",
"Value": {
......@@ -246,6 +270,14 @@
"resourceType": "GMSound"
}
},
{
"Key": "66cb56da-10e1-429f-bc02-58366b9c896a",
"Value": {
"id": "5bb81826-0601-4d8d-99b3-cf5e2da7e642",
"resourcePath": "sounds\\snd_move\\snd_move.yy",
"resourceType": "GMSound"
}
},
{
"Key": "68982bb5-9464-41f3-ace4-53820dcf767b",
"Value": {
......@@ -334,6 +366,14 @@
"resourceType": "GMObject"
}
},
{
"Key": "a7ac8c65-9ab7-49c7-b1de-29ab26920da9",
"Value": {
"id": "54381276-dd42-4e0b-ae7e-757e3e22d132",
"resourcePath": "sprites\\spr_shield\\spr_shield.yy",
"resourceType": "GMSprite"
}
},
{
"Key": "ab55ff82-88fb-4d1d-9ec1-1dfd5e35d5d4",
"Value": {
......@@ -382,6 +422,14 @@
"resourceType": "GMFolder"
}
},
{
"Key": "c527e470-5c00-4fb7-9a47-149c8dc13f5f",
"Value": {
"id": "a8da06cf-c3f1-4779-a40b-fddfdf41f5c4",
"resourcePath": "objects\\obj_trail\\obj_trail.yy",
"resourceType": "GMObject"
}
},
{
"Key": "c5b4d9ab-a98a-4a25-84e6-9e62545650bc",
"Value": {
......@@ -414,11 +462,19 @@
"resourceType": "GMFolder"
}
},
{
"Key": "d47aae3f-90df-4349-9dc1-b23ac0e9fde5",
"Value": {
"id": "b31aa15d-de0d-4431-b252-b85e12075cee",
"resourcePath": "sprites\\spr_broken\\spr_broken.yy",
"resourceType": "GMSprite"
}
},
{
"Key": "d9f8c331-83a4-4abe-ba7b-9b90eaaca4fb",
"Value": {
"id": "9b1b83dc-f26d-4cdd-aaa7-b89a2beabca1",
"resourcePath": "sounds\\snd_zap\\snd_zap.yy",
"resourcePath": "sounds\\snd_collect\\snd_collect.yy",
"resourceType": "GMSound"
}
},
......@@ -430,6 +486,14 @@
"resourceType": "GMSprite"
}
},
{
"Key": "e7fe412f-f93b-4e3f-ab23-1593e2d32ba9",
"Value": {
"id": "e6408f8f-f600-4f6c-8263-0969c9309e84",
"resourcePath": "objects\\obj_shield\\obj_shield.yy",
"resourceType": "GMObject"
}
},
{
"Key": "f9cd9c4e-812b-45d4-a2d2-49f898a19261",
"Value": {
......
direction = irandom_range(0, 359);
image_angle = irandom_range(0, 359);
speed = 0.1;
\ No newline at end of file
speed = 1;
......@@ -14,4 +14,4 @@ if(choose(0, 1) == 0){
instance_create_layer(xx, yy, "Instances", obj_asteroid);
alarm[0] = 4*room_speed;
\ No newline at end of file
alarm[0] = asteroidRate;
\ No newline at end of file
......@@ -15,22 +15,27 @@ if(choose(0, 1) == 0){
random_resource = choose(1, 2, 3);
random_resource = choose(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
switch(random_resource)
{
case 1:
instance_create_layer(xx, yy, "Instances", obj_oxygen);
break;
case 2:
instance_create_layer(xx, yy, "Instances", obj_water);
break;
case 3:
case 4:
instance_create_layer(xx, yy, "Instances", obj_water);
break;
case 5:
case 6:
case 7:
instance_create_layer(xx, yy, "Instances", obj_energy);
break;
case 4:
instance_create_layer(xx, yy, "Instances", obj_fix);
case 8:
case 9:
instance_create_layer(xx, yy, "Instances", obj_oxygen);
break;
case 10:
instance_create_layer(xx, yy, "Instances", obj_fix);
break;
};
alarm[0] = 8*room_speed;
\ No newline at end of file
alarm[2] = creationRate;
\ No newline at end of file
alarm[3] = 60;
if(instance_exists(obj_ship)){
score -= 1;
}
\ No newline at end of file
lives = 3;
lives = 1;
draw_set_font(fnt_text);
randomize();
\ No newline at end of file
randomize();
alarm[3] = 60;
if window_get_caption() != "Space Survival"
{
window_set_caption("Space Survival");
}
score = 180;
\ No newline at end of file
......@@ -2,15 +2,11 @@ switch(room){
case rm_game:
draw_set_halign(fa_center);
draw_text (250, 15,
@"OBJECTIVE:
SURVIVE"
);
@"REMAINING TIME: "+string(score)
);
draw_set_halign(fa_left);
draw_set_halign(fa_right);
draw_text ( 485, 15, "Lives: " +string(lives));
draw_set_halign(fa_right);
draw_sprite(spr_health_bar_bg, 1, 15, 15);
if (instance_exists(obj_ship)){
......@@ -41,20 +37,27 @@ SURVIVE"
draw_set_halign(fa_center);
var c = c_yellow;
draw_text_transformed_color(
room_width/2, 100, "SPACE ROCKS",
room_width/2, 100, "SPACE SURVIVAL",
3 ,3, 0, c,c,c,c, 1
);
draw_text(
room_width/2, 200,
@"Score 1,000 points to win!
@"Survive 3 minutes to win!
UP: move
LEFT/RIGHT: change direction
SPACE: shoot
SPACE BAR: activate energy shield
>>PRESS ENTER TO START<<
Press [S] for story
"
);
draw_text_transformed(
room_width/2, 475, "Copyright Codin G Bros",
.5 ,.5, 0
);
draw_set_halign(fa_left);
break;
......@@ -79,15 +82,43 @@ SPACE: shoot
room_width/2, 150, "GAME OVER",
3 ,3, 0, c,c,c,c, 1
);
draw_text(
room_width/2, 250,
"FINAL SCORE: "+string(score)
);
room_width/2, 250,"YOUR SURVIVAL TIME WAS: "+string(score)
);
draw_text(
room_width/2, 300,
">>PRESS ENTER TO RESTART<<"
);
draw_set_halign(fa_left);
break;
case rm_story:
draw_set_halign(fa_center);
draw_text(
room_width/2, 15,
@"STORY:
In 2358 humanity has
completely colonized the
Milky Way. During their ad-
venture they discovered 22 in-
tellingent species. During a tra-
ding jorney between the humans and
the mystics the starcruiser was attacked
by Drac pirates. Most of the crew got wiped
out by the pirates but some managed to escape
in escapepods. However they are running out of
air, water, and energy.
They must find asteroids
that carry these vital resources
to they survival while avoiding other
asteroids that would damage the ship on impact.
>>PRESS ENTER TO START"
);
}
if(room == rm_game){
if(audio_is_playing(msc_song)){
audio_stop_sound(msc_song);
if(audio_is_playing(msc_music)){
audio_stop_sound(msc_music);
}
audio_play_sound(msc_song, 2, true);
audio_play_sound(msc_music, 2, true);
repeat(3){
repeat(6){
var xx = choose(
irandom_range(0, room_width*0.3),
irandom_range(room_width*0.7, room_width)
......@@ -43,6 +43,7 @@ if(room == rm_game){
break;
case 2:
instance_create_layer(xx, yy, "Instances", obj_water);
instance_create_layer(xx, yy, "Instances", obj_fix);
break;
case 3:
instance_create_layer(xx, yy, "Instances", obj_energy);
......@@ -50,6 +51,9 @@ if(room == rm_game){
case 4:
instance_create_layer(xx, yy, "Instances", obj_fix);
break;
case 5:
instance_create_layer(xx, yy, "Instances", obj_fix);
break;
};
}
alarm[2] = 120;
......
var i_d = ds_map_find_value(async_load, "id");
if(i_d == msg){
if(ds_map_find_value(async_load, "status"))
{
if(ds_map_find_value(async_load, "result") != "")
{
player = ds_map_find_value(async_load, "result");
}
}
}
if(keyboard_check_pressed(vk_enter)){
switch(room){
case rm_start:
case rm_story:
room_goto(rm_game);
break;
......@@ -13,8 +14,14 @@ if(keyboard_check_pressed(vk_enter)){
}
}
if(room == rm_start){
if(keyboard_check_pressed(ord("S"))){
room_goto(rm_story);
}
}
if(room == rm_game){
if(score >= 1000){
if(score <= 0){
room_goto(rm_win);
}
if(room == rm_game){
......@@ -23,3 +30,4 @@ if(room == rm_game){
}
}
}
......@@ -73,6 +73,26 @@
"enumb": 2,
"eventtype": 2,
"m_owner": "26cf25c0-511b-411c-94da-e983c5762b2c"
},
{
"id": "f125818a-cc6d-49d5-83c7-99ff720f4b7a",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"enumb": 63,
"eventtype": 7,
"m_owner": "26cf25c0-511b-411c-94da-e983c5762b2c"
},
{
"id": "fcf1a4ad-151f-4920-a820-3f78f8e979cd",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"enumb": 3,
"eventtype": 2,
"m_owner": "26cf25c0-511b-411c-94da-e983c5762b2c"
}
],
"maskSpriteId": "00000000-0000-0000-0000-000000000000",
......@@ -91,7 +111,64 @@
"physicsShape": 1,
"physicsShapePoints": null,
"physicsStartAwake": true,
"properties": null,
"properties": [
{
"id": "b0c888f5-4106-450a-883c-92f1660a5d8b",
"modelName": "GMObjectProperty",
"mvc": "1.0",
"listItems": null,
"multiselect": false,
"rangeEnabled": false,
"rangeMax": 10,
"rangeMin": 0,
"resourceFilter": 1023,
"value": "0",
"varName": "player",
"varType": 2
},
{
"id": "ee58afd3-35fb-46ab-87a0-25deb2862013",
"modelName": "GMObjectProperty",
"mvc": "1.0",
"listItems": null,
"multiselect": false,
"rangeEnabled": false,
"rangeMax": 10,
"rangeMin": 0,
"resourceFilter": 1023,
"value": "0",
"varName": "msg",
"varType": 0
},
{
"id": "04312f44-c98d-46c0-a831-bfc9c940adf0",
"modelName": "GMObjectProperty",
"mvc": "1.0",
"listItems": null,
"multiselect": false,
"rangeEnabled": false,
"rangeMax": 10,
"rangeMin": 0,
"resourceFilter": 1023,
"value": "400",
"varName": "creationRate",
"varType": 1
},
{
"id": "23328e02-29ff-4783-9cb4-bb655c610ec0",
"modelName": "GMObjectProperty",
"mvc": "1.0",
"listItems": null,
"multiselect": false,
"rangeEnabled": false,
"rangeMax": 10,
"rangeMin": 0,
"resourceFilter": 1023,
"value": "120",
"varName": "asteroidRate",
"varType": 0
}
],
"solid": false,
"spriteId": "00000000-0000-0000-0000-000000000000",
"visible": true
......
if (instance_exists(obj_shield))
instance_destroy();
\ No newline at end of file
x = obj_ship.x;
y = obj_ship.y;
\ No newline at end of file
{
"id": "e7fe412f-f93b-4e3f-ab23-1593e2d32ba9",
"modelName": "GMObject",
"mvc": "1.0",
"name": "obj_shield",
"eventList": [
{
"id": "0b59808e-fa6d-4576-b1a2-446237513257",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"enumb": 0,
"eventtype": 0,
"m_owner": "e7fe412f-f93b-4e3f-ab23-1593e2d32ba9"
},
{
"id": "178ae753-fb3d-4ed4-9a41-b4571f98c70b",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"enumb": 0,
"eventtype": 2,
"m_owner": "e7fe412f-f93b-4e3f-ab23-1593e2d32ba9"
},
{
"id": "1432575b-9523-48cb-9b9d-667fe5e7334f",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "719aaadb-3a37-460f-8935-5418d39d23a5",
"enumb": 0,
"eventtype": 4,
"m_owner": "e7fe412f-f93b-4e3f-ab23-1593e2d32ba9"
},
{
"id": "1680a91a-e0ec-4aaf-9750-30ff38ad9a34",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"enumb": 0,
"eventtype": 3,
"m_owner": "e7fe412f-f93b-4e3f-ab23-1593e2d32ba9"
}
],
"maskSpriteId": "00000000-0000-0000-0000-000000000000",
"overriddenProperties": null,
"parentObjectId": "00000000-0000-0000-0000-000000000000",
"persistent": false,
"physicsAngularDamping": 0.1,
"physicsDensity": 0.5,
"physicsFriction": 0.2,
"physicsGroup": 0,
"physicsKinematic": false,
"physicsLinearDamping": 0.1,
"physicsObject": false,
"physicsRestitution": 0.1,
"physicsSensor": false,
"physicsShape": 1,
"physicsShapePoints": null,
"physicsStartAwake": true,
"properties": null,
"solid": false,
"spriteId": "a7ac8c65-9ab7-49c7-b1de-29ab26920da9",
"visible": true
}
\ No newline at end of file
if(oxygen > 0){
oxygen -= 1;
oxygen -= ocr;
}
if(oxygen < 0){
if(oxygen <= 0){
lives = 0
}
if (water > 0)
water -= 1;
water -= wcr;
if (water == 0)
speed = 0.06
if (water >= 55)
......
alarm[1] = 600;
\ No newline at end of file
......@@ -8,3 +8,5 @@ if (oxygen < 100)
instance_destroy(other)
alarm[0] = 60;
audio_play_sound(snd_collect, 1, false);
\ No newline at end of file
......@@ -5,4 +5,6 @@ if (water < 100)
water += 25;
if (water > 100)
water = 100;
}
\ No newline at end of file
}
audio_play_sound(snd_collect, 1, false);
\ No newline at end of file
ocr = 45;
wcr = 40;
ecr = 39;
instance_destroy(other)
energy = 100;
water = 100;
oxygen = 100;
lives = 3;
\ No newline at end of file
lives = 3;
ocr = 1;
wcr = 1;
ecr = 1;
sprite_index = spr_ship;
audio_play_sound(snd_collect, 1, false);
\ No newline at end of file
oxygen = 0;
lives -= 1;
instance_destroy();
repeat(10){
instance_create_layer(x,y, "Instances", obj_debris)
}
audio_play_sound(snd_hurt, 1, false);
with(obj_game){
alarm[1] = room_speed;
}
if(sprite_index = spr_asteroid_big){
random_resource = choose(1, 2, 3);
switch(random_resource)
{
case 1:
ocr = ocr/2;
break;
case 2:
wcr = wcr/2;
break;
case 3:
ecr = ecr/2;
break;
};
if (obj_asteroid){
instance_create_layer(x = obj_ship.x, y = obj_ship.y, "Instances", obj_trail)
}
if(sprite_index = spr_asteroid_big){
random_resource = choose(1, 2, 3);
switch(random_resource)
{
case 1:
ocr = ocr*3/4;
break;
case 2:
wcr = wcr*3/4;
break;
case 3:
ecr = ecr*3/4;
break;
};
if(other){
if(sprite_index == spr_asteroid_huge){
repeat(2){
var new_asteroid = instance_create_layer(x,y, "Instances", obj_asteroid);
new_asteroid.sprite_index = spr_asteroid_big;
}
} else if(sprite_index == spr_asteroid_big){
repeat(2){
var new_asteroid = instance_create_layer(x,y, "Instances", obj_asteroid);
new_asteroid.sprite_index = spr_asteroid_small;
}
}
repeat(10){
instance_create_layer(x,y, "Instances", obj_debris)
}
if(sprite_index = spr_asteroid_small){
random_resource = choose(1, 2, 3);
switch(random_resource)
{
case 1:
ocr = ocr*4/5;
break;
case 2:
wcr = wcr*4/5;
break;
case 3:
ecr = ecr*4/5;
break;
};
}
}
\ No newline at end of file
repeat(10){
instance_create_layer(x,y, "Instances", obj_debris)
}
}
if(obj_asteroid){
random_resource = choose(1, 2, 3);
switch(random_resource){
case 1:
ocr += 1;
alarm[1] = 60;
break;
case 2:
wcr += 1;
alarm[1] = 60;
break;
case 3:
ecr += 1;
alarm[1] = 60;
break;
}
}
sprite_index = spr_broken;
instance_destroy(other);
\ No newline at end of file
......@@ -6,4 +6,6 @@ if (energy < 100)
}
instance_destroy(other)
alarm[0] = 60;
\ No newline at end of file
alarm[0] = 60;
audio_play_sound(snd_collect, 1, false);
\ No newline at end of file
......@@ -7,6 +7,19 @@ if(keyboard_check(vk_right)){