]> _ Git - aichan-platformer.git/commitdiff
added an animation (it's not very good but at least the animation code is there now) horizons
authorparking_turkeys <roya1060wien@gmail.com>
Wed, 15 Jul 2026 13:59:38 +0000 (09:59 -0400)
committerparking_turkeys <roya1060wien@gmail.com>
Wed, 15 Jul 2026 13:59:38 +0000 (09:59 -0400)
dialogue-img/aichan-default.png [new file with mode: 0644]
player.c

diff --git a/dialogue-img/aichan-default.png b/dialogue-img/aichan-default.png
new file mode 100644 (file)
index 0000000..35b8310
Binary files /dev/null and b/dialogue-img/aichan-default.png differ
index fbae32e..2ec37f4 100644 (file)
--- a/player.c
+++ b/player.c
@@ -20,7 +20,7 @@ struct character *spielersetup(void)
        front_single = LoadTextureFromImage(img);
        UnloadImage(img);
        img = LoadImage("aichan-front-sheet.png");
-       struct spritesheet front_sheet = {img, 15, 18, 13};
+       front_sheet.img = img; front_sheet.width_each = 15; front_sheet.height_each = 18; front_sheet.columns=13;
        UnloadImage(img);
        sheets[0] = &front_sheet;
        txtr = LoadTextureFromImage(front_sheet.img);
@@ -34,12 +34,13 @@ int spielerzeichnen(void)
        time_since_switch += delta_player;
        if (time_since_switch >= FRAMELENGTH) {
                UnloadTexture(txtr);
-               
-               Image imgy = ImageFromImage((front_sheet.img),croprec);
+               Image imgy = LoadImage("aichan-front-sheet.png");
+               ImageCrop(&imgy,croprec);
                //ImageCrop(&imgy, croprec);
                txtr = LoadTextureFromImage(imgy);
                UnloadImage(imgy);
                time_since_switch = 0.0;
+               if (croprec.x < front_sheet.width_each * (front_sheet.columns - 1)) {croprec.x += front_sheet.width_each;} else {croprec.x = 0;};
                
        }
        DrawTexture(txtr, player.rect.x, player.rect.y, WHITE);