void Initialize() { m_TimeDebug.SetStartTime(); g_pImage = GfxImageLoad("Map.tga"); int iSizeX = GfxImageGetSizeX(g_pImage); SetTileS(); const int iArray = 4; TTile m_AllTile[iArray]; m_AllTile[0] = m_TileWall; m_AllTile[1] = m_TileFloor; m_AllTile[2] = m_TileEnd; m_AllTile[3] = m_TileStart; m_Map.SetSizeTile(float(GfxGetDisplaySizeX() / iSizeX)); m_Map.DrawMap(g_pImage, m_Sprite, m_AllTile, iArray); float fTexSize = m_Map.fSizeTile; m_Player.SetingSprite(fTexSize); m_Player.tPos = m_Map.GetStartMap(g_pImage, m_Sprite, m_TileStart); // GfxFullscreen(true); m_TimeDebug.GetExitTime(); }
void Update() { g_iCount++; TGfxVec2 tMove(0, 0); TGfxVec2 tEnd = m_Map.GetStartMap(g_pImage, m_Sprite, m_TileEnd); if(true) { if (GfxInputIsJustPressed(EGfxInputID_KeyArrowLeft))tMove.x -= m_Map.fSizeTile; else if (GfxInputIsJustPressed(EGfxInputID_KeyArrowRight))tMove.x += m_Map.fSizeTile; else if (GfxInputIsJustPressed(EGfxInputID_KeyArrowUp))tMove.y -= m_Map.fSizeTile; else if (GfxInputIsJustPressed(EGfxInputID_KeyArrowDown))tMove.y += m_Map.fSizeTile; } if (g_iCount % 10 == 0) { m_PathFinding.SeeAround(m_Player.tPos, tEnd, m_Map.fSizeTile, g_pImage, m_Sprite); } m_Player.tPos.x += tMove.x; m_Player.tPos.y += tMove.y; GfxSpriteSetPosition(m_Player.pSprite, m_Player.tPos.x, m_Player.tPos.y); }