Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Classy Clash
- * Project from GameDev.TV using alternate assets
- * Scott Bloom
- */
- #include "raylib.h"
- #include "raymath.h"
- #include "Character.h"
- int main()
- {
- int windowDimensions[2]{384, 384};
- InitWindow(windowDimensions[0], windowDimensions[1], "Classy Clash");
- // Create Textures
- Texture2D worldMap = LoadTexture("nature_tileset/OpenWorldMap24x24.png");
- // Texture2D swordUp = LoadTexture("characters/weapon_sword.png");
- // Texture2D swordDown = LoadTexture("characters/weapon_sword_1.png");
- // End Create Textures
- // Draw Map
- Vector2 mapPos{0.0, 0.0};
- const float mapScale{4.f};
- SetTargetFPS(60);
- Character knight;
- knight.setScreenPos(windowDimensions[0], windowDimensions[1]);
- while (!WindowShouldClose())
- {
- BeginDrawing();
- ClearBackground(WHITE);
- // Begin Game Logic
- mapPos = Vector2Scale(knight.getWorldPos(), -1.f);
- // Draw Map
- DrawTextureEx(worldMap, mapPos, 0.0, mapScale, WHITE);
- knight.tick(GetFrameTime());
- // Check Map Bounds
- if (knight.getWorldPos().x < 0.f ||
- knight.getWorldPos().y < 0 ||
- knight.getWorldPos().x + windowDimensions[0] > worldMap.width * mapScale ||
- knight.getWorldPos().y + windowDimensions[1] > worldMap.height * mapScale)
- {
- knight.undoMovement();
- }
- // End Game Logic
- EndDrawing();
- }
- CloseWindow();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement