rename spaceship variable to player

Mon, 04 Aug 2025 23:12:22 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 04 Aug 2025 23:12:22 +0200
changeset 248
793a0108c6c4
parent 247
3547254742a7
child 249
2522fbeccede

rename spaceship variable to player

test/snake/snake.c file | annotate | diff | comparison | revisions
--- a/test/snake/snake.c	Mon Aug 04 23:07:06 2025 +0200
+++ b/test/snake/snake.c	Mon Aug 04 23:12:22 2025 +0200
@@ -465,8 +465,8 @@
     // create UI elements
     fps_counter_create();
 
-    // create spaceship
-    Player *spaceship = player_create();
+    // create player
+    Player *player = player_create();
 
     // Main Loop
     do {
@@ -482,23 +482,23 @@
         // player rotation
         // TODO: queue up to two movement commands (for sharp 90° turns)
         if (asc_key_pressed(ASC_KEY(LEFT))) {
-            if (spaceship->direction != MOVE_RIGHT) {
-                spaceship->target_direction = MOVE_LEFT;
+            if (player->direction != MOVE_RIGHT) {
+                player->target_direction = MOVE_LEFT;
             }
         }
         if (asc_key_pressed(ASC_KEY(RIGHT))) {
-            if (spaceship->direction != MOVE_LEFT) {
-                spaceship->target_direction = MOVE_RIGHT;
+            if (player->direction != MOVE_LEFT) {
+                player->target_direction = MOVE_RIGHT;
             }
         }
         if (asc_key_pressed(ASC_KEY(UP))) {
-            if (spaceship->direction != MOVE_DOWN) {
-                spaceship->target_direction = MOVE_UP;
+            if (player->direction != MOVE_DOWN) {
+                player->target_direction = MOVE_UP;
             }
         }
         if (asc_key_pressed(ASC_KEY(DOWN))) {
-            if (spaceship->direction != MOVE_UP) {
-                spaceship->target_direction = MOVE_DOWN;
+            if (player->direction != MOVE_UP) {
+                player->target_direction = MOVE_DOWN;
             }
         }
 

mercurial