Hero::Hero(Game* game_n) : Sprite(game_n), Collidable(game_n) { game = game_n; setTileset("assets\\spaceship2.png"); setAnimation(LOOP, 0, 0, 12.f); flags |= ACTIVE; pos[1] += 300.f; AABB local; local.min.set(0.f, 0.f); local.max.set(INT_INFO(this, INT_SIZE_X), INT_INFO(this, INT_SIZE_Y)); Collidable::setParams(local, 40.f); game->addNode(this); shootDelay = 1.f; shootProj = 0; weapon = new ProjectileWeapon(game); weapon->setPositionLookup(&pos); weapon->setPositionTranslation(size+vec2(25.f, 7.5f)); setCollisionCallback(&colevent); colevent.hasCollided = false; shield = new Sprite(game); shield->setTileset("assets\\shield.png"); shield->setFrame(0); shield->flags &= ACTIVE; game->addNode(shield, this); shieldPower = 100.f; shieldShowTimer = 0.f; dying = false; score = 0; }
void Editor::setTilesetFromSettings() { setTileset(Prefs::tileSet()); }