test/snake/snake.c

changeset 215
a7c8e1727971
parent 214
9d460888a83e
--- a/test/snake/snake.c	Fri Jul 18 18:01:41 2025 +0200
+++ b/test/snake/snake.c	Sat Jul 19 21:29:10 2025 +0200
@@ -163,8 +163,8 @@
         .name = "Player",
         .texture = TEXTURE_SHIP,
         // TODO: introduce a function to set the position of a space ship
-        .x = game_field_tile_size * 8 - game_field_tile_size / 2,
-        .y = game_field_tile_size * 12 - game_field_tile_size / 2,
+        .x = game_field_tile_size * 8,
+        .y = game_field_tile_size * 12,
         .width = game_field_tile_size,
         .height = game_field_tile_size,
         .origin_x = game_field_tile_size / 2,
@@ -184,6 +184,7 @@
         for (unsigned y = 0; y < game_field_size; y+=game_field_tile_size) {
             AscSceneNode *tile = asc_rectangle(
                 .x = x, .y = y, .filled = true, .thickness = 1,
+                .origin_x = game_field_tile_size / 2, .origin_y = game_field_tile_size / 2,
                 .width = game_field_tile_size, .height = game_field_tile_size,
                 .color = ASC_RGB(0, 128, 255),
                 .border_color = ASC_RGB(64, 196, 255),
@@ -247,8 +248,8 @@
     asc_scene_init(MAIN_SCENE,
         .type = ASC_CAMERA_ORTHO,
         .ortho.rect = ASC_RECT(
-            -game_field_tile_size/2,
-            -game_field_tile_size/2,
+            -game_field_tile_size,
+            -game_field_tile_size,
             game_field_size+game_field_tile_size,
             game_field_size+game_field_tile_size
         ),

mercurial