mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-04 05:09:17 -05:00
Upload new game: Koala Seasons
This commit is contained in:
86
games/koala_seasons/screens/atlas01.h
Normal file
86
games/koala_seasons/screens/atlas01.h
Normal file
@ -0,0 +1,86 @@
|
||||
#define ending_button_replay (Rectangle){ 974, 1403, 123, 123 }
|
||||
#define ending_button_share (Rectangle){ 954, 1528, 123, 123 }
|
||||
#define ending_button_shop (Rectangle){ 958, 1653, 123, 123 }
|
||||
#define ending_button_trophy (Rectangle){ 1479, 386, 123, 123 }
|
||||
#define ending_goals_board (Rectangle){ 2, 254, 761, 422 }
|
||||
#define ending_goals_check_plate (Rectangle){ 316, 2006, 36, 34 }
|
||||
#define ending_goals_check_v (Rectangle){ 1727, 239, 50, 42 }
|
||||
#define ending_goals_check_x (Rectangle){ 354, 1885, 42, 51 }
|
||||
#define ending_goals_icon_death (Rectangle){ 1382, 516, 60, 60 }
|
||||
#define ending_goals_icon_leaves (Rectangle){ 1444, 516, 60, 60 }
|
||||
#define ending_goals_icon_special (Rectangle){ 1506, 511, 60, 60 }
|
||||
#define ending_goals_icon_time (Rectangle){ 1568, 511, 60, 60 }
|
||||
#define ending_paint_back (Rectangle){ 765, 254, 258, 305 }
|
||||
#define ending_paint_frame (Rectangle){ 103, 1028, 334, 393 }
|
||||
#define ending_paint_koalabee (Rectangle){ 439, 1060, 219, 216 }
|
||||
#define ending_paint_koaladingo (Rectangle){ 439, 1278, 219, 216 }
|
||||
#define ending_paint_koalaeagle (Rectangle){ 405, 1496, 219, 216 }
|
||||
#define ending_paint_koalafire (Rectangle){ 771, 643, 219, 216 }
|
||||
#define ending_paint_koalageneric (Rectangle){ 516, 678, 253, 250 }
|
||||
#define ending_paint_koalaowl (Rectangle){ 661, 1790, 100, 81 }
|
||||
#define ending_paint_koalasnake (Rectangle){ 774, 861, 219, 216 }
|
||||
#define ending_plate_frame (Rectangle){ 2, 2, 1052, 250 }
|
||||
#define ending_plate_headbee (Rectangle){ 1318, 516, 62, 60 }
|
||||
#define ending_plate_headdingo (Rectangle){ 1481, 182, 56, 70 }
|
||||
#define ending_plate_headeagle (Rectangle){ 1974, 116, 39, 48 }
|
||||
#define ending_plate_headowl (Rectangle){ 226, 1885, 68, 52 }
|
||||
#define ending_plate_headsnake (Rectangle){ 65, 1968, 46, 67 }
|
||||
#define ending_score_enemyicon (Rectangle){ 661, 1697, 113, 91 }
|
||||
#define ending_score_frame (Rectangle){ 419, 1714, 119, 123 }
|
||||
#define ending_score_frameback (Rectangle){ 540, 1714, 119, 123 }
|
||||
#define ending_score_leavesicon (Rectangle){ 1387, 254, 135, 130 }
|
||||
#define ending_score_planklarge (Rectangle){ 1056, 132, 525, 48 }
|
||||
#define ending_score_planksmall (Rectangle){ 1583, 116, 389, 48 }
|
||||
#define ending_score_seasonicon (Rectangle){ 925, 1265, 135, 136 }
|
||||
#define ending_score_seasonneedle (Rectangle){ 2032, 2, 12, 45 }
|
||||
#define gameplay_countdown_1 (Rectangle){ 660, 1302, 110, 216 }
|
||||
#define gameplay_countdown_2 (Rectangle){ 2, 1750, 110, 216 }
|
||||
#define gameplay_countdown_3 (Rectangle){ 114, 1728, 110, 216 }
|
||||
#define gameplay_enemy_bee (Rectangle){ 1025, 486, 250, 60 }
|
||||
#define gameplay_enemy_dingo (Rectangle){ 755, 1079, 240, 150 }
|
||||
#define gameplay_enemy_eagle (Rectangle){ 1570, 2, 460, 80 }
|
||||
#define gameplay_enemy_eagle_death (Rectangle){ 1327, 386, 150, 128 }
|
||||
#define gameplay_enemy_owl (Rectangle){ 765, 561, 240, 80 }
|
||||
#define gameplay_enemy_snake (Rectangle){ 1025, 254, 360, 128 }
|
||||
#define gameplay_fx_eaglealert (Rectangle){ 660, 1060, 93, 240 }
|
||||
#define gameplay_fx_lightraymid (Rectangle){ 2, 1028, 54, 710 }
|
||||
#define gameplay_gui_leafcounter_base (Rectangle){ 626, 1520, 178, 175 }
|
||||
#define gameplay_gui_leafcounter_cell (Rectangle){ 972, 1231, 32, 32 }
|
||||
#define gameplay_gui_leafcounter_glow (Rectangle){ 806, 1519, 146, 146 }
|
||||
#define gameplay_gui_leafcounter_pulsel (Rectangle){ 226, 1728, 157, 155 }
|
||||
#define gameplay_gui_seasonsclock_base (Rectangle){ 772, 1265, 151, 150 }
|
||||
#define gameplay_gui_seasonsclock_disc (Rectangle){ 103, 1423, 300, 303 }
|
||||
#define gameplay_koala_dash (Rectangle){ 1079, 1528, 100, 100 }
|
||||
#define gameplay_koala_die (Rectangle){ 1083, 1630, 100, 100 }
|
||||
#define gameplay_koala_fly (Rectangle){ 114, 1946, 200, 100 }
|
||||
#define gameplay_koala_idle (Rectangle){ 1025, 384, 300, 100 }
|
||||
#define gameplay_koala_jump (Rectangle){ 1083, 1732, 100, 100 }
|
||||
#define gameplay_koala_menu (Rectangle){ 806, 1667, 150, 100 }
|
||||
#define gameplay_koala_transform (Rectangle){ 772, 1417, 200, 100 }
|
||||
#define gameplay_props_burnttree (Rectangle){ 58, 1028, 43, 720 }
|
||||
#define gameplay_props_fire_spritesheet (Rectangle){ 516, 930, 256, 128 }
|
||||
#define gameplay_props_ice_sprite (Rectangle){ 385, 1728, 32, 128 }
|
||||
#define gameplay_props_leaf_big (Rectangle){ 1857, 166, 64, 64 }
|
||||
#define gameplay_props_leaf_lil (Rectangle){ 1923, 166, 64, 64 }
|
||||
#define gameplay_props_leaf_mid (Rectangle){ 316, 1940, 64, 64 }
|
||||
#define gameplay_props_resin_sprite (Rectangle){ 405, 1423, 32, 64 }
|
||||
#define gameplay_props_whirlwind_spritesheet (Rectangle){ 1056, 2, 512, 128 }
|
||||
#define particle_dandelion (Rectangle){ 354, 2006, 32, 32 }
|
||||
#define particle_ecualyptusflower (Rectangle){ 1989, 166, 32, 32 }
|
||||
#define particle_ecualyptusleaf (Rectangle){ 1989, 200, 32, 32 }
|
||||
#define particle_hit (Rectangle){ 296, 1885, 56, 53 }
|
||||
#define particle_icecrystal (Rectangle){ 419, 1839, 32, 32 }
|
||||
#define particle_planetreeleaf (Rectangle){ 453, 1839, 32, 32 }
|
||||
#define particle_waterdrop (Rectangle){ 487, 1839, 32, 32 }
|
||||
#define title_facebook (Rectangle){ 1539, 182, 92, 92 }
|
||||
#define title_googleplay (Rectangle){ 1524, 276, 92, 92 }
|
||||
#define title_music_off (Rectangle){ 1790, 166, 65, 66 }
|
||||
#define title_music_on (Rectangle){ 1277, 486, 39, 66 }
|
||||
#define title_speaker_off (Rectangle){ 2, 1968, 61, 71 }
|
||||
#define title_speaker_on (Rectangle){ 1727, 166, 61, 71 }
|
||||
#define title_textsnow01 (Rectangle){ 1570, 84, 439, 30 }
|
||||
#define title_textsnow02 (Rectangle){ 1056, 182, 423, 48 }
|
||||
#define title_textsnow03 (Rectangle){ 755, 1231, 215, 32 }
|
||||
#define title_textsnow04 (Rectangle){ 1056, 232, 414, 20 }
|
||||
#define title_titletext (Rectangle){ 2, 678, 512, 348 }
|
||||
#define title_twitter (Rectangle){ 1633, 166, 92, 92 }
|
||||
40
games/koala_seasons/screens/atlas02.h
Normal file
40
games/koala_seasons/screens/atlas02.h
Normal file
@ -0,0 +1,40 @@
|
||||
#define background_fog02 (Rectangle){ 644, 2, 500, 311 }
|
||||
#define background_transformation (Rectangle){ 2, 364, 500, 400 }
|
||||
#define ending_background (Rectangle){ 2, 766, 256, 256 }
|
||||
#define gameplay_back_fx_lightraymid (Rectangle){ 260, 766, 14, 216 }
|
||||
#define gameplay_back_ground00 (Rectangle){ 1146, 2, 640, 77 }
|
||||
#define gameplay_back_ground01 (Rectangle){ 1146, 81, 640, 77 }
|
||||
#define gameplay_back_ground02 (Rectangle){ 1146, 160, 640, 77 }
|
||||
#define gameplay_back_ground03 (Rectangle){ 1146, 239, 640, 77 }
|
||||
#define gameplay_back_tree01_layer01 (Rectangle){ 1833, 353, 28, 335 }
|
||||
#define gameplay_back_tree01_layer02 (Rectangle){ 1998, 338, 28, 335 }
|
||||
#define gameplay_back_tree01_layer03 (Rectangle){ 660, 315, 28, 335 }
|
||||
#define gameplay_back_tree02_layer01 (Rectangle){ 690, 315, 26, 332 }
|
||||
#define gameplay_back_tree02_layer02 (Rectangle){ 718, 315, 26, 332 }
|
||||
#define gameplay_back_tree02_layer03 (Rectangle){ 746, 315, 26, 332 }
|
||||
#define gameplay_back_tree03_layer01 (Rectangle){ 2028, 338, 15, 329 }
|
||||
#define gameplay_back_tree03_layer02 (Rectangle){ 774, 315, 15, 329 }
|
||||
#define gameplay_back_tree03_layer03 (Rectangle){ 791, 315, 15, 329 }
|
||||
#define gameplay_back_tree04_layer01 (Rectangle){ 1860, 2, 38, 334 }
|
||||
#define gameplay_back_tree04_layer02 (Rectangle){ 1900, 2, 38, 334 }
|
||||
#define gameplay_back_tree04_layer03 (Rectangle){ 1940, 2, 38, 334 }
|
||||
#define gameplay_back_tree05_layer01 (Rectangle){ 504, 364, 32, 349 }
|
||||
#define gameplay_back_tree05_layer02 (Rectangle){ 538, 364, 32, 349 }
|
||||
#define gameplay_back_tree05_layer03 (Rectangle){ 572, 364, 32, 349 }
|
||||
#define gameplay_back_tree06_layer01 (Rectangle){ 1980, 2, 31, 334 }
|
||||
#define gameplay_back_tree06_layer02 (Rectangle){ 2013, 2, 31, 334 }
|
||||
#define gameplay_back_tree06_layer03 (Rectangle){ 1863, 338, 31, 334 }
|
||||
#define gameplay_back_tree07_layer01 (Rectangle){ 606, 364, 25, 349 }
|
||||
#define gameplay_back_tree07_layer02 (Rectangle){ 633, 364, 25, 349 }
|
||||
#define gameplay_back_tree07_layer03 (Rectangle){ 1833, 2, 25, 349 }
|
||||
#define gameplay_back_tree08_layer01 (Rectangle){ 1896, 338, 32, 331 }
|
||||
#define gameplay_back_tree08_layer02 (Rectangle){ 1930, 338, 32, 331 }
|
||||
#define gameplay_back_tree08_layer03 (Rectangle){ 1964, 338, 32, 331 }
|
||||
#define gameplay_background (Rectangle){ 2, 2, 640, 360 }
|
||||
#define gameplay_props_owl_branch (Rectangle){ 808, 349, 36, 24 }
|
||||
#define gameplay_props_tree (Rectangle){ 1788, 2, 43, 720 }
|
||||
#define particle_dandelion_bw (Rectangle){ 504, 715, 32, 32 }
|
||||
#define particle_ecualyptusflower_bw (Rectangle){ 808, 315, 32, 32 }
|
||||
#define particle_icecrystal_bw (Rectangle){ 276, 766, 32, 32 }
|
||||
#define particle_planetreeleaf_bw (Rectangle){ 538, 715, 32, 32 }
|
||||
#define particle_waterdrop_bw (Rectangle){ 842, 315, 32, 32 }
|
||||
530
games/koala_seasons/screens/screen_ending.c
Normal file
530
games/koala_seasons/screens/screen_ending.c
Normal file
@ -0,0 +1,530 @@
|
||||
/**********************************************************************************************
|
||||
*
|
||||
* raylib - Koala Seasons game
|
||||
*
|
||||
* Ending Screen Functions Definitions (Init, Update, Draw, Unload)
|
||||
*
|
||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||
* in the product documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||
* as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include "screens.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "atlas01.h"
|
||||
#include "atlas02.h"
|
||||
|
||||
typedef enum { DELAY, SEASONS, LEAVES, KILLS, REPLAY } EndingCounter;
|
||||
|
||||
typedef struct {
|
||||
Vector2 position;
|
||||
Vector2 speed;
|
||||
float rotation;
|
||||
float size;
|
||||
Color color;
|
||||
float alpha;
|
||||
bool active;
|
||||
} Particle;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition (local to this module)
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Ending screen global variables
|
||||
static EndingCounter endingCounter;
|
||||
|
||||
static int framesCounter;
|
||||
static int finishScreen;
|
||||
static int framesKillsCounter;
|
||||
|
||||
static Rectangle playButton;
|
||||
static Rectangle shopButton;
|
||||
static Rectangle trophyButton;
|
||||
static Rectangle shareButton;
|
||||
|
||||
static Color buttonPlayColor;
|
||||
static Color buttonShopColor;
|
||||
static Color buttonTrophyColor;
|
||||
static Color buttonShareColor;
|
||||
static Color backgroundColor;
|
||||
|
||||
static int currentScore;
|
||||
static int seasonsCounter;
|
||||
static int currentLeavesEnding;
|
||||
static int finalYears;
|
||||
static int replayTimer;
|
||||
static int yearsElapsed;
|
||||
static int initRotation;
|
||||
|
||||
static float clockRotation;
|
||||
static float finalRotation;
|
||||
|
||||
static bool replaying;
|
||||
static bool active[MAX_KILLS];
|
||||
|
||||
static char initMonthText[32];
|
||||
static char finalMonthText[32];
|
||||
|
||||
static Particle leafParticles[20];
|
||||
|
||||
static int drawTimer;
|
||||
|
||||
// Death texts
|
||||
const char textOwl01[32] = "Turned into a pretty";
|
||||
const char textOwl02[32] = "owl pellet";
|
||||
const char textDingo01[32] = "A dingo took your life";
|
||||
const char textFire01[32] = "Kissed by fire";
|
||||
const char textSnake01[32] = "Digested alive by a";
|
||||
const char textSnake02[32] = "big snake";
|
||||
const char textNaturalDeath01[32] = "LIFE KILLED YOU";
|
||||
const char textBee01[32] = "You turn out to be";
|
||||
const char textBee02[32] = "allergic to bee sting";
|
||||
const char textEagle[32] = "KOALA IS DEAD :(";
|
||||
|
||||
static float LinearEaseIn(float t, float b, float c, float d) { return c*t/d + b; }
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Ending Screen Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Ending Screen Initialization logic
|
||||
void InitEndingScreen(void)
|
||||
{
|
||||
framesCounter = -10;
|
||||
finishScreen = 0;
|
||||
drawTimer = 15;
|
||||
replayTimer = 0;
|
||||
replaying = false;
|
||||
finalYears = initYears + (seasons/4);
|
||||
yearsElapsed = seasons/4;
|
||||
|
||||
playButton = (Rectangle){ GetScreenWidth()*0.871, GetScreenHeight()*0.096, 123, 123};
|
||||
shopButton = (Rectangle){ GetScreenWidth()*0.871, GetScreenHeight()*0.303, 123, 123};
|
||||
trophyButton = (Rectangle){ GetScreenWidth()*0.871, GetScreenHeight()*0.513, 123, 123};
|
||||
shareButton = (Rectangle){ GetScreenWidth()*0.871, GetScreenHeight()*0.719, 123, 123};
|
||||
|
||||
buttonPlayColor = WHITE;
|
||||
buttonShopColor = WHITE;
|
||||
buttonTrophyColor = WHITE;
|
||||
buttonShareColor = WHITE;
|
||||
|
||||
currentScore = 0;
|
||||
seasonsCounter = 0;
|
||||
currentLeavesEnding = 0;
|
||||
|
||||
endingCounter = DELAY;
|
||||
|
||||
backgroundColor = (Color){ 176, 167, 151, 255};
|
||||
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
leafParticles[j].active = false;
|
||||
leafParticles[j].position = (Vector2){ GetRandomValue(-20, 20), GetRandomValue(-20, 20) };
|
||||
leafParticles[j].speed = (Vector2){ (float)GetRandomValue(-500, 500)/100, (float)GetRandomValue(-500, 500)/100 };
|
||||
leafParticles[j].size = (float)GetRandomValue(3, 10)/5;
|
||||
leafParticles[j].rotation = GetRandomValue(0, 360);
|
||||
leafParticles[j].color = WHITE;
|
||||
leafParticles[j].alpha = 1;
|
||||
}
|
||||
|
||||
// Seasons death texts
|
||||
if (initSeason == 0)
|
||||
{
|
||||
sprintf(initMonthText, "SUMMER");
|
||||
clockRotation = 225;
|
||||
initRotation = 225;
|
||||
}
|
||||
else if (initSeason == 1)
|
||||
{
|
||||
sprintf(initMonthText, "AUTUMN");
|
||||
clockRotation = 135;
|
||||
initRotation = 135;
|
||||
}
|
||||
else if (initSeason == 2)
|
||||
{
|
||||
sprintf(initMonthText, "WINTER");
|
||||
clockRotation = 45;
|
||||
initRotation = 45;
|
||||
}
|
||||
else if (initSeason == 3)
|
||||
{
|
||||
sprintf(initMonthText, "SPRING");
|
||||
clockRotation = 315;
|
||||
initRotation = 315;
|
||||
}
|
||||
|
||||
if (currentSeason == 0)
|
||||
{
|
||||
sprintf(finalMonthText, "SUMMER");
|
||||
finalRotation = 225 + 360*yearsElapsed;
|
||||
}
|
||||
else if (currentSeason == 1)
|
||||
{
|
||||
sprintf(finalMonthText, "AUTUMN");
|
||||
finalRotation = 135 + 360*yearsElapsed;
|
||||
}
|
||||
else if (currentSeason == 2)
|
||||
{
|
||||
sprintf(finalMonthText, "WINTER");
|
||||
finalRotation = 45 + 360*yearsElapsed;
|
||||
}
|
||||
else if (currentSeason == 3)
|
||||
{
|
||||
sprintf(finalMonthText, "SPRING");
|
||||
finalRotation = 315 + 360*yearsElapsed;
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_KILLS; i++) active[i] = false;
|
||||
}
|
||||
|
||||
// Ending Screen Update logic
|
||||
void UpdateEndingScreen(void)
|
||||
{
|
||||
framesCounter += 1*TIME_FACTOR;
|
||||
|
||||
switch (endingCounter)
|
||||
{
|
||||
case DELAY:
|
||||
{
|
||||
if(framesCounter >= 10)
|
||||
{
|
||||
endingCounter = SEASONS;
|
||||
framesCounter = 0;
|
||||
}
|
||||
|
||||
} break;
|
||||
case SEASONS:
|
||||
{
|
||||
if (seasons > 0)
|
||||
{
|
||||
seasonsCounter = (int)LinearEaseIn((float)framesCounter, 0.0f, (float)(seasons), 90.0f);
|
||||
clockRotation = LinearEaseIn((float)framesCounter, (float)initRotation, (float)-(finalRotation - initRotation), 90.0f);
|
||||
|
||||
if (framesCounter >= 90)
|
||||
{
|
||||
endingCounter = LEAVES;
|
||||
framesCounter = 0;
|
||||
}
|
||||
}
|
||||
else endingCounter = LEAVES;
|
||||
|
||||
#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
|
||||
if (IsGestureDetected(GESTURE_TAP))
|
||||
{
|
||||
seasonsCounter = seasons;
|
||||
clockRotation = finalRotation;
|
||||
framesCounter = 0;
|
||||
endingCounter = LEAVES;
|
||||
}
|
||||
#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
|
||||
if (IsKeyPressed(KEY_ENTER))
|
||||
{
|
||||
seasonsCounter = seasons;
|
||||
clockRotation = finalRotation;
|
||||
framesCounter = 0;
|
||||
endingCounter = LEAVES;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
case LEAVES:
|
||||
{
|
||||
if (currentLeaves > 0)
|
||||
{
|
||||
if (currentLeavesEnding == currentLeaves)
|
||||
{
|
||||
endingCounter = KILLS;
|
||||
framesCounter = 0;
|
||||
}
|
||||
else if (currentLeavesEnding < currentLeaves)
|
||||
{
|
||||
if (framesCounter >= 4)
|
||||
{
|
||||
currentLeavesEnding += 1;
|
||||
framesCounter = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
if (!leafParticles[i].active)
|
||||
{
|
||||
leafParticles[i].position = (Vector2){ GetScreenWidth()*0.46, GetScreenHeight()*0.32};
|
||||
leafParticles[i].alpha = 1.0f;
|
||||
leafParticles[i].active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else endingCounter = KILLS;
|
||||
|
||||
#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
|
||||
if (IsGestureDetected(GESTURE_TAP))
|
||||
{
|
||||
currentLeavesEnding = currentLeaves;
|
||||
framesCounter = 0;
|
||||
endingCounter = KILLS;
|
||||
}
|
||||
#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
|
||||
if (IsKeyPressed(KEY_ENTER))
|
||||
{
|
||||
currentLeavesEnding = currentLeaves;
|
||||
framesCounter = 0;
|
||||
endingCounter = KILLS;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
case KILLS:
|
||||
{
|
||||
if (score > 0)
|
||||
{
|
||||
if (framesCounter <= 90 && !replaying)
|
||||
{
|
||||
currentScore = (int)LinearEaseIn((float)framesCounter, 0.0f, (float)(score), 90.0f);
|
||||
}
|
||||
|
||||
framesKillsCounter += 1*TIME_FACTOR;
|
||||
|
||||
for (int i = 0; i < MAX_KILLS; i++)
|
||||
{
|
||||
if (framesKillsCounter >= drawTimer && active[i] == false)
|
||||
{
|
||||
active[i] = true;
|
||||
framesKillsCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (framesCounter >= 90)
|
||||
{
|
||||
endingCounter = REPLAY;
|
||||
framesCounter = 0;
|
||||
}
|
||||
}
|
||||
else endingCounter = REPLAY;
|
||||
|
||||
#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
|
||||
if (IsGestureDetected(GESTURE_TAP))
|
||||
{
|
||||
currentScore = score;
|
||||
framesCounter = 0;
|
||||
for (int i = 0; i < MAX_KILLS; i++) active[i] = true;
|
||||
endingCounter = REPLAY;
|
||||
}
|
||||
#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
|
||||
if (IsKeyPressed(KEY_ENTER))
|
||||
{
|
||||
currentScore = score;
|
||||
framesCounter = 0;
|
||||
for (int i = 0; i < MAX_KILLS; i++) active[i] = true;
|
||||
endingCounter = REPLAY;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
case REPLAY:
|
||||
{
|
||||
#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
|
||||
if (IsGestureDetected(GESTURE_TAP)) replaying = true;
|
||||
#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
|
||||
if (IsKeyPressed(KEY_ENTER)) replaying = true;
|
||||
#endif
|
||||
if (replaying)
|
||||
{
|
||||
replayTimer += 1*TIME_FACTOR;
|
||||
|
||||
if (replayTimer >= 30)
|
||||
{
|
||||
finishScreen = 1;
|
||||
initSeason = GetRandomValue(0, 3);
|
||||
}
|
||||
|
||||
buttonPlayColor = GOLD;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
if (leafParticles[i].active == true)
|
||||
{
|
||||
leafParticles[i].position.x += leafParticles[i].speed.x;
|
||||
leafParticles[i].position.y += leafParticles[i].speed.y;
|
||||
leafParticles[i].rotation += 6;
|
||||
leafParticles[i].alpha -= 0.03f;
|
||||
leafParticles[i].size -= 0.004;
|
||||
|
||||
if (leafParticles[i].size <= 0) leafParticles[i].size = 0.0f;
|
||||
|
||||
if (leafParticles[i].alpha <= 0)
|
||||
{
|
||||
leafParticles[i].alpha = 0.0f;
|
||||
leafParticles[i].active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Buttons logic
|
||||
#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
|
||||
if ((IsGestureDetected(GESTURE_TAP)) && CheckCollisionPointRec(GetTouchPosition(0), playButton))
|
||||
{
|
||||
endingCounter = REPLAY;
|
||||
replaying = true;
|
||||
}
|
||||
|
||||
#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
|
||||
if (CheckCollisionPointRec(GetMousePosition(), playButton))
|
||||
{
|
||||
buttonPlayColor = GOLD;
|
||||
if (IsMouseButtonPressed(0))
|
||||
{
|
||||
endingCounter = REPLAY;
|
||||
replaying = true;
|
||||
}
|
||||
}
|
||||
else buttonPlayColor = WHITE;
|
||||
|
||||
if (CheckCollisionPointRec(GetMousePosition(), shopButton)) buttonShopColor = GOLD;
|
||||
else buttonShopColor = WHITE;
|
||||
|
||||
if (CheckCollisionPointRec(GetMousePosition(), trophyButton)) buttonTrophyColor = GOLD;
|
||||
else buttonTrophyColor = WHITE;
|
||||
|
||||
if (CheckCollisionPointRec(GetMousePosition(), shareButton)) buttonShareColor = GOLD;
|
||||
else buttonShareColor = WHITE;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Ending Screen Draw logic
|
||||
void DrawEndingScreen(void)
|
||||
{
|
||||
for (int x = 0; x < 15; x++)
|
||||
{
|
||||
DrawTextureRec(atlas02, ending_background, (Vector2){ending_background.width*(x%5), ending_background.height*(x/5)}, backgroundColor);
|
||||
}
|
||||
|
||||
// Frames and backgrounds
|
||||
DrawTexturePro(atlas01, ending_plate_frame, (Rectangle){GetScreenWidth()*0.042, GetScreenHeight()*0.606, ending_plate_frame.width, ending_plate_frame.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
DrawTexturePro(atlas01, ending_paint_back, (Rectangle){GetScreenWidth()*0.133, GetScreenHeight()*0.097, ending_paint_back.width, ending_paint_back.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
|
||||
if (killer == 0) DrawTexturePro(atlas01, ending_paint_koalafire, (Rectangle){GetScreenWidth()*0.145, GetScreenHeight()*0.171, ending_paint_koalafire.width, ending_paint_koalafire.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
else if (killer == 1) DrawTexturePro(atlas01, ending_paint_koalasnake, (Rectangle){GetScreenWidth()*0.145, GetScreenHeight()*0.171, ending_paint_koalasnake.width, ending_paint_koalasnake.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
else if (killer == 2) DrawTexturePro(atlas01, ending_paint_koaladingo, (Rectangle){GetScreenWidth()*0.145, GetScreenHeight()*0.171, ending_paint_koaladingo.width, ending_paint_koaladingo.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
else if (killer == 3) DrawTexturePro(atlas01, ending_paint_koalaowl, (Rectangle){GetScreenWidth()*0.2, GetScreenHeight()*0.3, ending_paint_koalaowl.width, ending_paint_koalaowl.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
else if (killer == 4) DrawTexturePro(atlas01, ending_paint_koalageneric, (Rectangle){GetScreenWidth()*0.133, GetScreenHeight()*0.171, ending_paint_koalageneric.width, ending_paint_koalageneric.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
else if (killer == 5) DrawTexturePro(atlas01, ending_paint_koalabee, (Rectangle){GetScreenWidth()*0.145, GetScreenHeight()*0.171, ending_paint_koalabee.width, ending_paint_koalabee.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
else if (killer == 6) DrawTexturePro(atlas01, ending_paint_koalaeagle, (Rectangle){GetScreenWidth()*0.145, GetScreenHeight()*0.171, ending_paint_koalaeagle.width, ending_paint_koalaeagle.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
|
||||
DrawTexturePro(atlas01, ending_paint_frame, (Rectangle){GetScreenWidth()*0.102, GetScreenHeight()*0.035, ending_paint_frame.width, ending_paint_frame.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
|
||||
// UI Score planks
|
||||
DrawTexturePro(atlas01, ending_score_planksmall, (Rectangle){GetScreenWidth()*0.521, GetScreenHeight()*0.163, ending_score_planksmall.width, ending_score_planksmall.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
DrawTexturePro(atlas01, ending_score_planklarge, (Rectangle){GetScreenWidth()*0.415, GetScreenHeight()*0.303, ending_score_planklarge.width, ending_score_planklarge.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
DrawTexturePro(atlas01, ending_score_planksmall, (Rectangle){GetScreenWidth()*0.521, GetScreenHeight()*0.440, ending_score_planksmall.width, ending_score_planksmall.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
|
||||
// UI Score icons and frames
|
||||
DrawTexturePro(atlas01, ending_score_seasonicon, (Rectangle){GetScreenWidth()*0.529, GetScreenHeight()*0.096, ending_score_seasonicon.width, ending_score_seasonicon.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
DrawTexturePro(atlas01, ending_score_seasonneedle, (Rectangle){GetScreenWidth()*0.579, GetScreenHeight()*0.189, ending_score_seasonneedle.width, ending_score_seasonneedle.height}, (Vector2){ending_score_seasonneedle.width/2, ending_score_seasonneedle.height*0.9}, clockRotation, WHITE);
|
||||
DrawTexturePro(atlas01, ending_score_frame, (Rectangle){GetScreenWidth()*0.535, GetScreenHeight()*0.11, ending_score_frame.width, ending_score_frame.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
|
||||
DrawTexturePro(atlas01, ending_score_frameback, (Rectangle){GetScreenWidth()*0.430, GetScreenHeight()*0.246, ending_score_frameback.width, ending_score_frameback.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
DrawTexturePro(atlas01, ending_score_frame, (Rectangle){GetScreenWidth()*0.429, GetScreenHeight()*0.244, ending_score_frame.width, ending_score_frame.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
if (leafParticles[i].active)
|
||||
{
|
||||
DrawTexturePro(atlas01, particle_ecualyptusleaf,
|
||||
(Rectangle){ leafParticles[i].position.x, leafParticles[i].position.y, particle_ecualyptusleaf.width*leafParticles[i].size, particle_ecualyptusleaf.height*leafParticles[i].size },
|
||||
(Vector2){ particle_ecualyptusleaf.width/2*leafParticles[i].size, particle_ecualyptusleaf.height/2*leafParticles[i].size }, leafParticles[i].rotation, Fade(WHITE,leafParticles[i].alpha));
|
||||
}
|
||||
}
|
||||
|
||||
DrawTexturePro(atlas01, ending_score_leavesicon, (Rectangle){GetScreenWidth()*0.421, GetScreenHeight()*0.228, ending_score_leavesicon.width, ending_score_leavesicon.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
|
||||
DrawTexturePro(atlas01, ending_score_frameback, (Rectangle){GetScreenWidth()*0.536, GetScreenHeight()*0.383, ending_score_frameback.width, ending_score_frameback.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
DrawTexturePro(atlas01, ending_score_frame, (Rectangle){GetScreenWidth()*0.535, GetScreenHeight()*0.383, ending_score_frame.width, ending_score_frame.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
DrawTexturePro(atlas01, ending_score_enemyicon, (Rectangle){GetScreenWidth()*0.538, GetScreenHeight()*0.414, ending_score_enemyicon.width, ending_score_enemyicon.height}, (Vector2){ 0, 0}, 0, WHITE);
|
||||
|
||||
// UI Buttons
|
||||
DrawTexturePro(atlas01, ending_button_replay, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.096, ending_button_replay.width, ending_button_replay.height}, (Vector2){ 0, 0}, 0, buttonPlayColor);
|
||||
DrawTexturePro(atlas01, ending_button_shop, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.303, ending_button_shop.width, ending_button_shop.height}, (Vector2){ 0, 0}, 0, buttonShopColor);
|
||||
DrawTexturePro(atlas01, ending_button_trophy, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.513, ending_button_trophy.width, ending_button_trophy.height}, (Vector2){ 0, 0}, 0, buttonTrophyColor);
|
||||
DrawTexturePro(atlas01, ending_button_share, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.719, ending_button_share.width, ending_button_share.height}, (Vector2){ 0, 0}, 0, buttonShareColor);
|
||||
|
||||
DrawTextEx(font, FormatText("%03i", seasonsCounter), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.14f }, font.size, 1, WHITE);
|
||||
DrawTextEx(font, FormatText("%03i", currentLeavesEnding), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.29f }, font.size, 1, WHITE);
|
||||
DrawTextEx(font, FormatText("%04i", currentScore), (Vector2){ GetScreenWidth()*0.715f, GetScreenHeight()*0.426f }, font.size, 1, WHITE);
|
||||
|
||||
DrawTextEx(font, FormatText("%s %i - %s %i", initMonthText, initYears, finalMonthText, finalYears), (Vector2){ GetScreenWidth()*0.1f, GetScreenHeight()*0.7f }, font.size/2.0f, 1, WHITE);
|
||||
|
||||
for (int i = 0; i < MAX_KILLS; i++)
|
||||
{
|
||||
if (active[i])
|
||||
{
|
||||
switch (killHistory[i])
|
||||
{
|
||||
case 1: DrawTextureRec(atlas01, ending_plate_headsnake, (Vector2){GetScreenWidth()*0.448 + ending_plate_headsnake.width*(i%10), GetScreenHeight()*0.682 + (GetScreenHeight()*0.055)*(i/10)}, WHITE); break;
|
||||
case 2: DrawTextureRec(atlas01, ending_plate_headdingo, (Vector2){GetScreenWidth()*0.448 + ending_plate_headdingo.width*(i%10), GetScreenHeight()*0.682 + (GetScreenHeight()*0.055)*(i/10)}, WHITE); break;
|
||||
case 3: DrawTextureRec(atlas01, ending_plate_headowl, (Vector2){GetScreenWidth()*0.448 + ending_plate_headowl.width*(i%10), GetScreenHeight()*0.682 + (GetScreenHeight()*0.055)*(i/10)}, WHITE); break;
|
||||
case 4: DrawTextureRec(atlas01, ending_plate_headbee, (Vector2){GetScreenWidth()*0.448 + ending_plate_headbee.width*(i%10), GetScreenHeight()*0.682 + (GetScreenHeight()*0.055)*(i/10)}, WHITE); break;
|
||||
case 5: DrawTextureRec(atlas01, ending_plate_headeagle, (Vector2){GetScreenWidth()*0.448 + ending_plate_headeagle.width*(i%10), GetScreenHeight()*0.682 + (GetScreenHeight()*0.055)*(i/10)}, WHITE); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DrawText(FormatText("KOALA IS DEAD :("), GetScreenWidth()/2 - MeasureText("YOU'RE DEAD ", 60)/2, GetScreenHeight()/3, 60, RED);
|
||||
DrawText(FormatText("Score: %02i - HiScore: %02i", score, hiscore),GetScreenWidth()/2 - MeasureText("Score: 00 - HiScore: 00", 60)/2, GetScreenHeight()/3 +100, 60, RED);
|
||||
DrawText(FormatText("You lived: %02i years", years),GetScreenWidth()/2 - MeasureText("You lived: 00", 60)/2 + 60, GetScreenHeight()/3 +200, 30, RED);
|
||||
DrawText(FormatText("%02s killed you", killer),GetScreenWidth()/2 - MeasureText("killer killed you", 60)/2 + 90, GetScreenHeight()/3 +270, 30, RED);
|
||||
//DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(BLACK, 0.5));
|
||||
*/
|
||||
|
||||
//DrawTextEx(font, FormatText("%02s", killer), (Vector2){ GetScreenWidth()*0.08, GetScreenHeight()*0.78 }, font.size/2, 1, WHITE);
|
||||
if (killer == 0) DrawTextEx(font, textFire01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
|
||||
else if (killer == 2) DrawTextEx(font, textDingo01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
|
||||
else if (killer == 1)
|
||||
{
|
||||
DrawTextEx(font, textSnake01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
|
||||
DrawTextEx(font, textSnake02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.size/2.0f, 1, WHITE);
|
||||
}
|
||||
else if (killer == 3)
|
||||
{
|
||||
DrawTextEx(font, textOwl01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
|
||||
DrawTextEx(font, textOwl02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.size/2.0f, 1, WHITE);
|
||||
}
|
||||
else if (killer == 4) DrawTextEx(font, textNaturalDeath01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
|
||||
else if (killer == 5)
|
||||
{
|
||||
DrawTextEx(font, textBee01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
|
||||
DrawTextEx(font, textBee02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.size/2.0f, 1, WHITE);
|
||||
}
|
||||
else if (killer == 6) DrawTextEx(font, textEagle, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
|
||||
}
|
||||
|
||||
// Ending Screen Unload logic
|
||||
void UnloadEndingScreen(void)
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
// Ending Screen should finish?
|
||||
int FinishEndingScreen(void)
|
||||
{
|
||||
return finishScreen;
|
||||
}
|
||||
3937
games/koala_seasons/screens/screen_gameplay.c
Normal file
3937
games/koala_seasons/screens/screen_gameplay.c
Normal file
File diff suppressed because it is too large
Load Diff
227
games/koala_seasons/screens/screen_logo.c
Normal file
227
games/koala_seasons/screens/screen_logo.c
Normal file
@ -0,0 +1,227 @@
|
||||
/**********************************************************************************************
|
||||
*
|
||||
* raylib - Standard Game template
|
||||
*
|
||||
* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
|
||||
*
|
||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||
* in the product documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||
* as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include "screens.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition (local to this module)
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Logo screen global variables
|
||||
static int framesCounter;
|
||||
static int finishScreen;
|
||||
|
||||
const char msgLogoA[64] = "A simple and easy-to-use library";
|
||||
const char msgLogoB[64] = "to learn videogames programming";
|
||||
|
||||
int logoPositionX;
|
||||
int logoPositionY;
|
||||
|
||||
int raylibLettersCount = 0;
|
||||
|
||||
int topSideRecWidth = 16;
|
||||
int leftSideRecHeight = 16;
|
||||
|
||||
int bottomSideRecWidth = 16;
|
||||
int rightSideRecHeight = 16;
|
||||
|
||||
char raylib[8] = " \0"; // raylib text array, max 8 letters
|
||||
|
||||
int logoScreenState = 0; // Tracking animation states (State Machine)
|
||||
bool msgLogoADone = false;
|
||||
bool msgLogoBDone = false;
|
||||
|
||||
int lettersCounter = 0;
|
||||
char msgBuffer[128] = { ' ' };
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Logo Screen Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Logo Screen Initialization logic
|
||||
void InitLogoScreen(void)
|
||||
{
|
||||
// Initialize LOGO screen variables here!
|
||||
framesCounter = 0;
|
||||
finishScreen = 0;
|
||||
|
||||
logoPositionX = GetScreenWidth()/2 - 128;
|
||||
logoPositionY = GetScreenHeight()/2 - 128;
|
||||
}
|
||||
|
||||
// Logo Screen Update logic
|
||||
void UpdateLogoScreen(void)
|
||||
{
|
||||
// Update LOGO screen
|
||||
framesCounter++; // Count frames
|
||||
|
||||
// Update LOGO screen variables
|
||||
if (logoScreenState == 0) // State 0: Small box blinking
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
if (framesCounter == 120)
|
||||
{
|
||||
logoScreenState = 1;
|
||||
framesCounter = 0; // Reset counter... will be used later...
|
||||
}
|
||||
}
|
||||
else if (logoScreenState == 1) // State 1: Top and left bars growing
|
||||
{
|
||||
topSideRecWidth += 4;
|
||||
leftSideRecHeight += 4;
|
||||
|
||||
if (topSideRecWidth == 256) logoScreenState = 2;
|
||||
}
|
||||
else if (logoScreenState == 2) // State 2: Bottom and right bars growing
|
||||
{
|
||||
bottomSideRecWidth += 4;
|
||||
rightSideRecHeight += 4;
|
||||
|
||||
if (bottomSideRecWidth == 256)
|
||||
{
|
||||
lettersCounter = 0;
|
||||
for (int i = 0; i < (int)strlen(msgBuffer); i++) msgBuffer[i] = ' ';
|
||||
|
||||
logoScreenState = 3;
|
||||
}
|
||||
}
|
||||
else if (logoScreenState == 3) // State 3: Letters appearing (one by one)
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
// Every 12 frames, one more letter!
|
||||
if ((framesCounter%12) == 0) raylibLettersCount++;
|
||||
|
||||
switch (raylibLettersCount)
|
||||
{
|
||||
case 1: raylib[0] = 'r'; break;
|
||||
case 2: raylib[1] = 'a'; break;
|
||||
case 3: raylib[2] = 'y'; break;
|
||||
case 4: raylib[3] = 'l'; break;
|
||||
case 5: raylib[4] = 'i'; break;
|
||||
case 6: raylib[5] = 'b'; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (raylibLettersCount >= 10)
|
||||
{
|
||||
// Write raylib description messages
|
||||
if ((framesCounter%2) == 0) lettersCounter++;
|
||||
|
||||
if (!msgLogoADone)
|
||||
{
|
||||
if (lettersCounter <= (int)strlen(msgLogoA)) strncpy(msgBuffer, msgLogoA, lettersCounter);
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < (int)strlen(msgBuffer); i++) msgBuffer[i] = ' ';
|
||||
|
||||
lettersCounter = 0;
|
||||
msgLogoADone = true;
|
||||
}
|
||||
}
|
||||
else if (!msgLogoBDone)
|
||||
{
|
||||
if (lettersCounter <= (int)strlen(msgLogoB)) strncpy(msgBuffer, msgLogoB, lettersCounter);
|
||||
else
|
||||
{
|
||||
msgLogoBDone = true;
|
||||
framesCounter = 0;
|
||||
//PlaySound(levelWin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for 2 seconds (60 frames) before jumping to TITLE screen
|
||||
if (msgLogoBDone)
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
if (framesCounter > 150) finishScreen = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Logo Screen Draw logic
|
||||
void DrawLogoScreen(void)
|
||||
{
|
||||
// Draw LOGO screen
|
||||
if (logoScreenState == 0)
|
||||
{
|
||||
if ((framesCounter/15)%2) DrawRectangle(logoPositionX, logoPositionY - 60, 16, 16, BLACK);
|
||||
}
|
||||
else if (logoScreenState == 1)
|
||||
{
|
||||
DrawRectangle(logoPositionX, logoPositionY - 60, topSideRecWidth, 16, BLACK);
|
||||
DrawRectangle(logoPositionX, logoPositionY - 60, 16, leftSideRecHeight, BLACK);
|
||||
}
|
||||
else if (logoScreenState == 2)
|
||||
{
|
||||
DrawRectangle(logoPositionX, logoPositionY - 60, topSideRecWidth, 16, BLACK);
|
||||
DrawRectangle(logoPositionX, logoPositionY - 60, 16, leftSideRecHeight, BLACK);
|
||||
|
||||
DrawRectangle(logoPositionX + 240, logoPositionY - 60, 16, rightSideRecHeight, BLACK);
|
||||
DrawRectangle(logoPositionX, logoPositionY + 240 - 60, bottomSideRecWidth, 16, BLACK);
|
||||
}
|
||||
else if (logoScreenState == 3)
|
||||
{
|
||||
DrawRectangle(logoPositionX, logoPositionY - 60, topSideRecWidth, 16, BLACK);
|
||||
DrawRectangle(logoPositionX, logoPositionY + 16 - 60, 16, leftSideRecHeight - 32, BLACK);
|
||||
|
||||
DrawRectangle(logoPositionX + 240, logoPositionY + 16 - 60, 16, rightSideRecHeight - 32, BLACK);
|
||||
DrawRectangle(logoPositionX, logoPositionY + 240 - 60, bottomSideRecWidth, 16, BLACK);
|
||||
|
||||
DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112 - 60, 224, 224, RAYWHITE);
|
||||
|
||||
DrawText(raylib, GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48 - 60, 50, BLACK);
|
||||
|
||||
if (!msgLogoADone) DrawText(msgBuffer, GetScreenWidth()/2 - MeasureText(msgLogoA, 30)/2, logoPositionY + 230, 30, GRAY);
|
||||
else
|
||||
{
|
||||
DrawText(msgLogoA, GetScreenWidth()/2 - MeasureText(msgLogoA, 30)/2, logoPositionY + 230, 30, GRAY);
|
||||
|
||||
if (!msgLogoBDone) DrawText(msgBuffer, GetScreenWidth()/2 - MeasureText(msgLogoB, 30)/2, logoPositionY + 280, 30, GRAY);
|
||||
else
|
||||
{
|
||||
DrawText(msgLogoB, GetScreenWidth()/2 - MeasureText(msgLogoA, 30)/2, logoPositionY + 280, 30, GRAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Logo Screen Unload logic
|
||||
void UnloadLogoScreen(void)
|
||||
{
|
||||
// TODO: Unload LOGO screen variables here!
|
||||
}
|
||||
|
||||
// Logo Screen should finish?
|
||||
int FinishLogoScreen(void)
|
||||
{
|
||||
return finishScreen;
|
||||
}
|
||||
1069
games/koala_seasons/screens/screen_title.c
Normal file
1069
games/koala_seasons/screens/screen_title.c
Normal file
File diff suppressed because it is too large
Load Diff
125
games/koala_seasons/screens/screens.h
Normal file
125
games/koala_seasons/screens/screens.h
Normal file
@ -0,0 +1,125 @@
|
||||
/**********************************************************************************************
|
||||
*
|
||||
* raylib - Koala Seasons game
|
||||
*
|
||||
* Screens Functions Declarations (Init, Update, Draw, Unload)
|
||||
*
|
||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||
* in the product documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||
* as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#ifndef SCREENS_H
|
||||
#define SCREENS_H
|
||||
|
||||
#define GAME_FPS 60.0
|
||||
#define TIME_FACTOR 60.0/GAME_FPS
|
||||
|
||||
#define MAX_KILLS 128
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
typedef enum GameScreen { LOGO, TITLE, OPTIONS, GAMEPLAY, ENDING } GameScreen;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
GameScreen currentScreen;
|
||||
|
||||
// NOTE: This is all the data used in the game
|
||||
SpriteFont font;
|
||||
Shader colorBlend;
|
||||
Texture2D atlas01;
|
||||
Texture2D atlas02;
|
||||
|
||||
Sound fxJump;
|
||||
Sound fxDash;
|
||||
Sound fxEatLeaves;
|
||||
Sound fxDieSnake;
|
||||
Sound fxDieDingo;
|
||||
Sound fxDieOwl;
|
||||
Sound fxHitResin;
|
||||
Sound fxWind;
|
||||
|
||||
// Global Variables (required by ending screen and gameplay screen)
|
||||
int score;
|
||||
int hiscore;
|
||||
int killHistory[MAX_KILLS];
|
||||
int killer;
|
||||
int seasons;
|
||||
int years;
|
||||
int currentLeaves;
|
||||
int currentSeason;
|
||||
int initSeason;
|
||||
int initYears;
|
||||
int rainChance;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { // Prevents name mangling of functions
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Logo Screen Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
void InitLogoScreen(void);
|
||||
void UpdateLogoScreen(void);
|
||||
void DrawLogoScreen(void);
|
||||
void UnloadLogoScreen(void);
|
||||
int FinishLogoScreen(void);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Title Screen Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
void InitTitleScreen(void);
|
||||
void UpdateTitleScreen(void);
|
||||
void DrawTitleScreen(void);
|
||||
void UnloadTitleScreen(void);
|
||||
int FinishTitleScreen(void);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Options Screen Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
void InitOptionsScreen(void);
|
||||
void UpdateOptionsScreen(void);
|
||||
void DrawOptionsScreen(void);
|
||||
void UnloadOptionsScreen(void);
|
||||
int FinishOptionsScreen(void);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Gameplay Screen Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
void InitGameplayScreen(void);
|
||||
void UpdateGameplayScreen(void);
|
||||
void DrawGameplayScreen(void);
|
||||
void UnloadGameplayScreen(void);
|
||||
int FinishGameplayScreen(void);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Ending Screen Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
void InitEndingScreen(void);
|
||||
void UpdateEndingScreen(void);
|
||||
void DrawEndingScreen(void);
|
||||
void UnloadEndingScreen(void);
|
||||
int FinishEndingScreen(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SCREENS_H
|
||||
Reference in New Issue
Block a user