écran game over
This commit is contained in:
parent
f92fda29f9
commit
8134191c10
8 changed files with 53 additions and 33 deletions
|
@ -15,7 +15,7 @@ global.minutes = 1;
|
|||
global.secondes = 20;
|
||||
global.transition = -1;
|
||||
|
||||
perdu = false;
|
||||
global.perdu = false;
|
||||
|
||||
posX = irandom(3);
|
||||
posY = irandom(3);
|
||||
|
|
|
@ -1,34 +1,43 @@
|
|||
if (room != rOver) {
|
||||
draw_rectangle_color(1280,0,display_get_gui_width(),96,c_black,c_black,c_black,c_black,false);
|
||||
|
||||
draw_rectangle_color(1280,0,display_get_gui_width(),display_get_gui_height() - 128,c_black,c_black,c_black,c_black,true);
|
||||
draw_text(1312,72,"map");
|
||||
|
||||
draw_text(640,16,"vie : " + string(oPlayer.pv));
|
||||
draw_text(640,16,"vie : " + string(oPlayer.pv));
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for(j = 0; j < 4; j++)
|
||||
{
|
||||
draw_text(i*16,j*16,tableau[i, j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
draw_text(640,16,"vie : " + string(oPlayer.pv));
|
||||
draw_text(640,16,"vie : " + string(oPlayer.pv));
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for(j = 0; j < 4; j++)
|
||||
{
|
||||
if (i = posX and j = posY) draw_text(i*16 + 1300,j*16,"o");
|
||||
else draw_text(i*16 + 1300,j*16,"-");
|
||||
}
|
||||
}
|
||||
|
||||
if (!global.perdu) draw_text(160,16, string(global.minutes) + " : " + string(global.secondes));
|
||||
else draw_text(160,16, "PERDU");
|
||||
|
||||
draw_text(320,16,global.difficulty);
|
||||
|
||||
draw_text(480,16,"pos : (" + string(posX) + ", " + string(posY) + ")");
|
||||
|
||||
draw_text(800,16,room_get_name(room));
|
||||
}
|
||||
|
||||
if (!perdu) draw_text(160,16, string(global.minutes) + " : " + string(global.secondes));
|
||||
else draw_text(160,16, "PERDU");
|
||||
else {
|
||||
draw_text_transformed(room_width / 2, room_height / 2, "GAME OVER!", 2, 2, image_angle);
|
||||
draw_text_transformed(room_width / 2, room_height / 2 + 128, "PRESS R TO RESTART", 2, 2, image_angle);
|
||||
}
|
||||
|
||||
draw_text(320,16,global.difficulty);
|
||||
|
||||
draw_text(480,16,"pos : (" + string(posX) + ", " + string(posY) + ")");
|
||||
|
||||
draw_text(800,16,room_get_name(room));
|
1
objects/oGame/KeyPress_82.gml
Normal file
1
objects/oGame/KeyPress_82.gml
Normal file
|
@ -0,0 +1 @@
|
|||
if (room = rOver) game_restart();
|
|
@ -1,14 +1,13 @@
|
|||
// chrono
|
||||
if (!perdu) {
|
||||
if (!global.perdu) {
|
||||
global.secondes -= 1/room_speed;
|
||||
|
||||
if (global.secondes <= 0) {
|
||||
global.minutes --;
|
||||
global.secondes = 20;
|
||||
if (global.minutes < 0) {
|
||||
global.perdu = true;
|
||||
}
|
||||
|
||||
if (global.minutes <= 0) {
|
||||
perdu = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,3 +31,10 @@ if (global.transition != -1) {
|
|||
global.transition = -1;
|
||||
room_goto(asset_get_index("r" + string(tableau[posX, posY])));
|
||||
}
|
||||
|
||||
// défaite
|
||||
|
||||
if (global.perdu) {
|
||||
room_goto(rOver);
|
||||
global.perdu = false;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
{"isDnD":false,"eventNum":69,"eventType":9,"collisionObjectId":null,"parent":{"name":"oGame","path":"objects/oGame/oGame.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
|
||||
{"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"parent":{"name":"oGame","path":"objects/oGame/oGame.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
|
||||
{"isDnD":false,"eventNum":72,"eventType":8,"collisionObjectId":null,"parent":{"name":"oGame","path":"objects/oGame/oGame.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
|
||||
{"isDnD":false,"eventNum":82,"eventType":9,"collisionObjectId":null,"parent":{"name":"oGame","path":"objects/oGame/oGame.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
|
||||
],
|
||||
"properties": [],
|
||||
"overriddenProperties": [],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
if (inv == 0) {
|
||||
hit(other, self, other.attack);
|
||||
inv = 120;
|
||||
inv = 30;
|
||||
} else {
|
||||
knockBack(other, self);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Suppression de l'invinsibilité
|
||||
if (inv > 0) {
|
||||
inv--;
|
||||
draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, image_angle, c_lime, image_alpha);
|
||||
draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, image_angle, c_red, image_alpha);
|
||||
} else {
|
||||
draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, image_angle, image_blend, image_alpha);
|
||||
}
|
|
@ -29,7 +29,10 @@ function knockBack(obj, objRepousse) {
|
|||
*/
|
||||
function hit(objAttaquant, objAttaque, degats) {
|
||||
objAttaque.pv -= degats;
|
||||
if (objAttaque.pv <= 0) instance_destroy(objAttaque);
|
||||
if (objAttaque.pv <= 0) {
|
||||
if (objAttaque.object_index = oPlayer) global.perdu = true;
|
||||
else instance_destroy(objAttaque);
|
||||
}
|
||||
else knockBack(objAttaquant, objAttaque);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue