From: parking_turkeys Date: Wed, 15 Jul 2026 13:59:38 +0000 (-0400) Subject: added an animation (it's not very good but at least the animation code is there now) X-Git-Tag: horizons^0 X-Git-Url: http://git.p-t.hackclub.app/?a=commitdiff_plain;h=1df02fbc89e05753a76a70fa4ea0b61672b5dfe2;p=aichan-platformer.git added an animation (it's not very good but at least the animation code is there now) --- diff --git a/dialogue-img/aichan-default.png b/dialogue-img/aichan-default.png new file mode 100644 index 0000000..35b8310 Binary files /dev/null and b/dialogue-img/aichan-default.png differ diff --git a/player.c b/player.c index fbae32e..2ec37f4 100644 --- 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);