- Animacio, orientacio, bot, ordre (encara hi ha bugs)...

This commit is contained in:
2023-03-07 18:55:39 +01:00
parent b919577ce7
commit f21e77b7fa
4 changed files with 141 additions and 39 deletions

View File

@@ -15,48 +15,29 @@ void game::init()
draw::loadPalette("test.gif");
game::setUpdateTicks(64);
box = actor::create({16,16,0}, {8,8,8}, {32,0,32,32}, {0,32});
box = actor::create({16,16,0}, {8,8,4}, {64,0,32,24}, {0,24});
box->flags = FLAG_MOVING;// | FLAG_PUSHABLE;
box->movement = MOV_Z;
box->mov_push = PUSH_ZP;
box->movement = MOV_X;
box->mov_push = PUSH_XP;
actor::setDirty(box, true);
box = actor::create({32,32,16}, {8,8,8}, {32,0,32,32}, {0,32});
box->flags = FLAG_PUSHABLE;
box->flags = FLAG_PUSHABLE | FLAG_GRAVITY;
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;
box = actor::create({16,16,8}, {8,8,8}, {0,32,20,32}, {-6,38});
box->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED;
actor::setDirty(box, true);
actor::reorder();
}
int sx=1, sy=0;
bool game::loop()
{
/*if (input::keyDown(SDL_SCANCODE_LEFT) && box->pos.x>0) {
box->pos.x--;
actor::actor_t *other = actor::get_collision(box);
if (other)
{
other->push |= 1;
box->pos.x++;
}
else
{
actor::setDirty(box);
}
}
if (input::keyDown(SDL_SCANCODE_RIGHT) && box->pos.x<42) { box->pos.x++; actor::setDirty(box); }
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); }*/
actor::update(actor::getFirst());
actor::reorder();