Exemplo n.º 1
0
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 );
			}
		}
	}
}
Exemplo n.º 2
0
PyObject *
_wrap_sprite_set_action_rotated (PyObject *self, PyObject *args)
{
	   PyObject *py_r;
	   char     *action;
	   int       degrees;
	   
	   if (!PyArg_ParseTuple (args, "Osi:set_action_rotated", &py_r, &action, &degrees)) return NULL;
	   GLASSERT (py_r && py_r != Py_None);
	   GLASSERT (action);
	   
	   KrSprite *r = AS_PTR (KrSprite, py_r);
	   GLASSERT (r);

	   r->SetActionRotated (action, degrees);

	   RETURN_NONE
}