wip-DudeSpaceMining.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Based on my old game project "Dude Space Mining " :
  2. // https://github.com/Pakz001/Monkey2examples/blob/master/games/dudespacemining5.monkey27
  3. // (Playable) https://cromdesi.home.xs4all.nl/emscripten/dudespacemining/Main.html
  4. //
  5. //
  6. // Create tilemap system of 20x100by20x100 tiles. Player starts at position 10x10. In the Tilemap struct
  7. // a map is created for this start position(10x10) When the map scrolls near the edge then a new section
  8. // is created. In each map section a minable asteroid is created.
  9. #include "raylib.h"
  10. #define MAX_TILEMAPS 200
  11. static int map[20][20];
  12. typedef struct{
  13. Vector2 mapPosition;
  14. }Player;
  15. typedef struct {
  16. int map[100][100]; //20x100by20x100 tiles.
  17. }Tilemap;
  18. int main(void)
  19. {
  20. // Initialization
  21. //--------------------------------------------------------------------------------------
  22. const int screenWidth = 800;
  23. const int screenHeight = 450;
  24. InitWindow(screenWidth, screenHeight, "raylib example.");
  25. // Create all the tilemaps, they will be generated when needed.
  26. Tilemap playerMaps[MAX_TILEMAPS] = { 0 };
  27. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  28. //--------------------------------------------------------------------------------------
  29. // Main game loop
  30. while (!WindowShouldClose()) // Detect window close button or ESC key
  31. {
  32. // Update
  33. //----------------------------------------------------------------------------------
  34. //----------------------------------------------------------------------------------
  35. // Draw
  36. //----------------------------------------------------------------------------------
  37. BeginDrawing();
  38. ClearBackground(RAYWHITE);
  39. EndDrawing();
  40. //----------------------------------------------------------------------------------
  41. }
  42. // De-Initialization
  43. //--------------------------------------------------------------------------------------
  44. CloseWindow(); // Close window and OpenGL context
  45. //--------------------------------------------------------------------------------------
  46. return 0;
  47. }