- Colisions, movibles, reactius...

This commit is contained in:
2023-03-06 18:56:46 +01:00
parent 2942b85de7
commit 70d097a173
3 changed files with 256 additions and 17 deletions

View File

@@ -16,9 +16,20 @@ void game::init()
game::setUpdateTicks(64);
box = actor::create({16,16,0}, {8,8,8}, {32,0,32,32}, {0,32});
actor::setDirty(box);
box = actor::create({8,0,0}, {8,8,8}, {32,0,32,32}, {0,32});
actor::setDirty(box);
box->flags = FLAG_MOVING;// | FLAG_PUSHABLE;
box->movement = MOV_Z;
box->mov_push = PUSH_ZP;
actor::setDirty(box, true);
box = actor::create({32,32,16}, {8,8,8}, {32,0,32,32}, {0,32});
box->flags = FLAG_PUSHABLE;
box->movement = MOV_CW;
box->mov_push = PUSH_XN;
actor::setDirty(box, true);
box = actor::create({16,16,16}, {8,8,8}, {32,0,32,32}, {0,32});
box->flags = FLAG_HERO | FLAG_PUSHABLE;
actor::setDirty(box, true);
actor::reorder();
}
@@ -26,7 +37,7 @@ int sx=1, sy=0;
bool game::loop()
{
if (input::keyDown(SDL_SCANCODE_LEFT) && box->pos.x>0) {
/*if (input::keyDown(SDL_SCANCODE_LEFT) && box->pos.x>0) {
box->pos.x--;
actor::actor_t *other = actor::get_collision(box);
if (other)
@@ -44,7 +55,9 @@ bool game::loop()
if (input::keyDown(SDL_SCANCODE_UP) && box->pos.y>0) { box->pos.y--; actor::setDirty(box); }
if (input::keyDown(SDL_SCANCODE_DOWN) && box->pos.y<42) { box->pos.y++; actor::setDirty(box); }
if (input::keyDown(SDL_SCANCODE_Z) && box->pos.z>0) { box->pos.z--; actor::setDirty(box); }
if (input::keyDown(SDL_SCANCODE_A) && box->pos.z<42) { box->pos.z++; actor::setDirty(box); }
if (input::keyDown(SDL_SCANCODE_A) && box->pos.z<42) { box->pos.z++; actor::setDirty(box); }*/
actor::update(actor::getFirst());
actor::reorder();
draw::cls(8);