void BemGame::AddFloor() { int i, j, x, y; KrResource* resource = engine->Vault()->GetResource( KYRATAG_SPRITE, BEM_ROOM | BEM_FLOOR ); GLASSERT( resource ); KrSpriteResource* spriteRes = resource->ToSpriteResource(); GLASSERT( spriteRes ); // The map is backwards. It is reference [y][x] and is upside // down to boot. *sigh* for( i=0; i<MAPX; i++ ) { for( j=0; j<MAPY; j++ ) { if ( GetMap( i, j ) == FLOOR ) { KrSprite* sprite = new KrSprite( spriteRes ); isoMath->TileToScreen( i, j, 0, &x, &y ); sprite->SetPos( x, y ); sprite->SetActionRotated( "NONE", ((i+j)%4) * 90 ); // So much for abstraction. if ( ( j == 2 || j == 9 ) && ( i == 4 || i == 7 ) ) sprite->SetFrame( 1 ); else sprite->SetFrame( 0 ); engine->Tree()->AddNode( floorTree, sprite ); } } } }
void EdStateMovie::StateOpening() { movieNode = new KrImNode(); shared->Engine()->Tree()->AddNode( shared->ImNode(), movieNode ); // Create the action, put it in a sprite resource. KrAction* movieAction = shared->CreateAnimationAction(); if ( movieAction ) { spriteResource = new KrSpriteResource( "AlignerSprite" ); spriteResource->AddAction( movieAction ); numFrames = spriteResource->GetActionByIndex( 0 )->NumFrames(); KrSprite* sprite = new KrSprite( spriteResource ); sprite->SetFrame( 0 ); sprite->SetNodeId( 0 ); KrRect rect = shared->Engine()->ScreenBounds(); sprite->SetPos( rect.Width() / 2, rect.Height() / 2 ); shared->Engine()->Tree()->AddNode( movieNode, sprite ); } shared->ConsoleNode()->SetVisible( false ); shared->SetInfoBox( false ); }
PyObject * _wrap_sprite_set_frame (PyObject *self, PyObject *args) { PyObject *py_r; int frame; if (!PyArg_ParseTuple (args, "Oi:set_frame", &py_r, &frame)) return NULL; GLASSERT (py_r && py_r != Py_None); KrSprite *r = AS_PTR (KrSprite, py_r); GLASSERT (r); r->SetFrame(frame); RETURN_NONE }