This commit is contained in:
kdx 2023-03-19 01:37:14 +01:00
parent 56d1c26ede
commit fd2c1baa4e
8 changed files with 17 additions and 3 deletions

View File

@ -21,6 +21,8 @@ set(SOURCES
src/main.c
src/map.c
src/player.c
src/rotrect.c
src/spike.c
)
set(ASSETS

View File

@ -1 +1 @@
{"width":25,"height":14,"data":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,0,1,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,1,0,0,1,1,1,1,1,0,0,1,1,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,1,1,0,0,1,1,1,0,0,0,0,1,0,0,0,1,0,1,1,1,1,0,1,1,0,1,1,0,0,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,0,1,1,2,0,1,0,0,0,1,0,1,1,0,1,1,0,0,1,0,0,0,1,1,0,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,0,1,1,0,4,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}
{"width":25,"height":14,"data":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0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

Width:  |  Height:  |  Size: 316 B

View File

@ -1,6 +1,7 @@
#include "lzy.h"
#include "cfg.h"
#include "rotrect.h"
#include <math.h>
long tick = 0;

View File

@ -3,6 +3,7 @@
#include "map.h"
#include "player.h"
#include "cfg.h"
#include "spike.h"
#include <string.h>
void
@ -64,6 +65,9 @@ game_restart_scene(Game *this)
case 4:
exit_init(game_create_entity(this), dx, dy);
break;
case 5:
spike_init(game_create_entity(this), dx, dy);
break;
default:
break;
}

View File

@ -1,4 +1,5 @@
#include "deathpart.h"
#include "entity.h"
#include "entityimpl.h"
#include "game.h"
#include "input.h"
@ -44,7 +45,8 @@ IMPL_UPDATE() {
if (this->vel[0] == 0.0 && this->vel[1] >= -0.0)
this->player.dirx *= -1;
if (this->bonk_ceiling) {
if (this->bonk_ceiling ||
entity_place_meeting(this, g, ET_spike) != NULL) {
int dy = this->pos[1] - 6;
for (int y = 0; y < 7; y++) {
int dx = this->pos[0] - 6;

View File

@ -1,4 +1,5 @@
#include "entityimpl.h"
#include "rotrect.h"
extern long tick;
@ -6,7 +7,11 @@ IMPL_UPDATE() {
} IMPL_END
IMPL_DRAW() {
const double angle = (float)tick / 16;
rotrect(this->pos[0], this->pos[1], 10, 10, angle);
rotrect(this->pos[0], this->pos[1], 10, 10, -angle);
} IMPL_END
IMPL_INIT(spike) {
this->height = this->width = 8;
} IMPL_END