summaryrefslogtreecommitdiffhomepage
path: root/games
diff options
context:
space:
mode:
authorRay <[email protected]>2017-04-18 10:42:15 +0200
committerRay <[email protected]>2017-04-18 10:42:15 +0200
commita5c8ce2a3470f8a5d66a021056b61ed9160f2da2 (patch)
treeb49b0669d97178e10b45fc3e3e842ae08c04fb2c /games
parent99c226b3441f571ec7fa0dfc13f52a8375d0c357 (diff)
downloadraylib-a5c8ce2a3470f8a5d66a021056b61ed9160f2da2.tar.gz
raylib-a5c8ce2a3470f8a5d66a021056b61ed9160f2da2.zip
Upload new game: Koala Seasons
Diffstat (limited to 'games')
-rw-r--r--games/koala_seasons/Makefile223
-rw-r--r--games/koala_seasons/koala_seasons.c281
-rw-r--r--games/koala_seasons/resources/audio/dash.oggbin0 -> 7449 bytes
-rw-r--r--games/koala_seasons/resources/audio/dingo_die.oggbin0 -> 8792 bytes
-rw-r--r--games/koala_seasons/resources/audio/eat_leaves.oggbin0 -> 11627 bytes
-rw-r--r--games/koala_seasons/resources/audio/jngl.xmbin0 -> 848187 bytes
-rw-r--r--games/koala_seasons/resources/audio/jump.oggbin0 -> 8118 bytes
-rw-r--r--games/koala_seasons/resources/audio/owl_die.oggbin0 -> 6502 bytes
-rw-r--r--games/koala_seasons/resources/audio/resin_hit.oggbin0 -> 9345 bytes
-rw-r--r--games/koala_seasons/resources/audio/snake_die.oggbin0 -> 7124 bytes
-rw-r--r--games/koala_seasons/resources/audio/wind_sound.oggbin0 -> 41895 bytes
-rw-r--r--games/koala_seasons/resources/graphics/atlas01.pngbin0 -> 2425307 bytes
-rw-r--r--games/koala_seasons/resources/graphics/atlas02.pngbin0 -> 919196 bytes
-rw-r--r--games/koala_seasons/resources/graphics/mainfont.pngbin0 -> 183047 bytes
-rw-r--r--games/koala_seasons/resources/shaders/glsl100/base.vs25
-rw-r--r--games/koala_seasons/resources/shaders/glsl100/blend_color.fs63
-rw-r--r--games/koala_seasons/resources/shaders/glsl330/base.vs25
-rw-r--r--games/koala_seasons/resources/shaders/glsl330/blend_color.fs64
-rw-r--r--games/koala_seasons/screens/atlas01.h86
-rw-r--r--games/koala_seasons/screens/atlas02.h40
-rw-r--r--games/koala_seasons/screens/screen_ending.c530
-rw-r--r--games/koala_seasons/screens/screen_gameplay.c3937
-rw-r--r--games/koala_seasons/screens/screen_logo.c227
-rw-r--r--games/koala_seasons/screens/screen_title.c1069
-rw-r--r--games/koala_seasons/screens/screens.h125
25 files changed, 6695 insertions, 0 deletions
diff --git a/games/koala_seasons/Makefile b/games/koala_seasons/Makefile
new file mode 100644
index 00000000..e90fb4f2
--- /dev/null
+++ b/games/koala_seasons/Makefile
@@ -0,0 +1,223 @@
+#**************************************************************************************************
+#
+# raylib - Koala Seasons
+#
+# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
+#
+# Copyright (c) 2013-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.
+#
+#**************************************************************************************************
+
+# define raylib platform to compile for
+# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
+# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
+PLATFORM ?= PLATFORM_DESKTOP
+
+# determine PLATFORM_OS in case PLATFORM_DESKTOP selected
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
+ ifeq ($(OS),Windows_NT)
+ PLATFORM_OS=WINDOWS
+ LIBPATH=win32
+ else
+ UNAMEOS:=$(shell uname)
+ ifeq ($(UNAMEOS),Linux)
+ PLATFORM_OS=LINUX
+ LIBPATH=linux
+ else
+ ifeq ($(UNAMEOS),Darwin)
+ PLATFORM_OS=OSX
+ LIBPATH=osx
+ endif
+ endif
+ endif
+endif
+
+# define compiler: gcc for C program, define as g++ for C++
+ifeq ($(PLATFORM),PLATFORM_WEB)
+ # define emscripten compiler
+ CC = emcc
+else
+ifeq ($(PLATFORM_OS),OSX)
+ # define llvm compiler for mac
+ CC = clang
+else
+ # define default gcc compiler
+ CC = gcc
+endif
+endif
+
+# define compiler flags:
+# -O2 defines optimization level
+# -Wall turns on most, but not all, compiler warnings
+# -std=c99 use standard C from 1999 revision
+ifeq ($(PLATFORM),PLATFORM_RPI)
+ CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline
+else
+ CFLAGS = -O2 -Wall -std=c99
+endif
+ifeq ($(PLATFORM),PLATFORM_WEB)
+ CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 --preload-file resources -s ALLOW_MEMORY_GROWTH=1
+ #-s ASSERTIONS=1 --preload-file resources
+ #-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
+ #-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
+endif
+
+#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
+# define any directories containing required header files
+INCLUDES = -I. -I../src -I../src/external
+
+ifeq ($(PLATFORM),PLATFORM_RPI)
+ INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
+endif
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ # add standard directories for GNU/Linux
+ ifeq ($(PLATFORM_OS),LINUX)
+ INCLUDES += -I/usr/local/include/raylib/
+ else ifeq ($(PLATFORM_OS),WINDOWS)
+ # external libraries headers
+ # GLFW3
+ INCLUDES += -I../src/external/glfw3/include
+ # OpenAL Soft
+ INCLUDES += -I../src/external/openal_soft/include
+ endif
+endif
+
+# define library paths containing required libs
+LFLAGS = -L. -L../src -L$(RAYLIB_PATH)
+
+ifeq ($(PLATFORM),PLATFORM_RPI)
+ LFLAGS += -L/opt/vc/lib
+endif
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ # add standard directories for GNU/Linux
+ ifeq ($(PLATFORM_OS),WINDOWS)
+ # external libraries to link with
+ # GLFW3
+ LFLAGS += -L../src/external/glfw3/lib/$(LIBPATH)
+ # OpenAL Soft
+ LFLAGS += -L../src/external/openal_soft/lib/$(LIBPATH)
+ endif
+endif
+
+# define any libraries to link into executable
+# if you want to link libraries (libname.so or libname.a), use the -lname
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ ifeq ($(PLATFORM_OS),LINUX)
+ # libraries for Debian GNU/Linux desktop compiling
+ # requires the following packages:
+ # libglfw3-dev libopenal-dev libegl1-mesa-dev
+ LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -pthread -ldl
+ # on XWindow could require also below libraries, just uncomment
+ #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
+ else
+ ifeq ($(PLATFORM_OS),OSX)
+ # libraries for OS X 10.9 desktop compiling
+ # requires the following packages:
+ # libglfw3-dev libopenal-dev libegl1-mesa-dev
+ LIBS = -lraylib -lglfw3 -framework OpenGL -framework OpenAl -framework Cocoa
+ else
+ # libraries for Windows desktop compiling
+ # NOTE: GLFW3 and OpenAL Soft libraries should be installed
+ LIBS = -lraylib -lglfw3 -lopengl32 -lopenal32 -lgdi32
+ endif
+ endif
+endif
+ifeq ($(PLATFORM),PLATFORM_RPI)
+ # libraries for Raspberry Pi compiling
+ # NOTE: OpenAL Soft library should be installed (libopenal1 package)
+ LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
+endif
+ifeq ($(PLATFORM),PLATFORM_WEB)
+ # just adjust the correct path to libraylib.bc
+ LIBS = ../release/html5/libraylib.bc
+endif
+
+# define additional parameters and flags for windows
+ifeq ($(PLATFORM_OS),WINDOWS)
+ # resources file contains windows exe icon
+ # -Wl,--subsystem,windows hides the console window
+ WINFLAGS = C:\raylib\raylib_icon
+endif
+
+ifeq ($(PLATFORM),PLATFORM_WEB)
+ EXT = .html
+endif
+
+# define all screen object files required
+SCREENS = \
+ screens/screen_logo.o \
+ screens/screen_title.o \
+ screens/screen_gameplay.o \
+ screens/screen_ending.o \
+
+# typing 'make' will invoke the first target entry in the file,
+# in this case, the 'default' target entry is koala_seasons
+default: koala_seasons
+
+# compile template - koala_seasons
+koala_seasons: koala_seasons.c $(SCREENS)
+ $(CC) -o $@$(EXT) $^ $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
+
+# compile screen LOGO
+screens/screen_logo.o: screens/screen_logo.c
+ $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
+
+# compile screen TITLE
+screens/screen_title.o: screens/screen_title.c
+ $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
+
+# compile screen OPTIONS
+screens/screen_options.o: screens/screen_options.c
+ $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
+
+# compile screen GAMEPLAY
+screens/screen_gameplay.o: screens/screen_gameplay.c
+ $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
+
+# compile screen ENDING
+screens/screen_ending.o: screens/screen_ending.c
+ $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
+
+# clean everything
+clean:
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ ifeq ($(PLATFORM_OS),OSX)
+ find . -type f -perm +ugo+x -delete
+ rm -f *.o
+ else
+ ifeq ($(PLATFORM_OS),LINUX)
+ find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
+ else
+ del *.o *.exe
+ endif
+ endif
+endif
+ifeq ($(PLATFORM),PLATFORM_RPI)
+ find . -type f -executable -delete
+ rm -f *.o
+endif
+ifeq ($(PLATFORM),PLATFORM_WEB)
+ del *.o *.html *.js
+endif
+ @echo Cleaning done
+
+# instead of defining every module one by one, we can define a pattern
+# this pattern below will automatically compile every module defined on $(OBJS)
+#%.exe : %.c
+# $(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM)
diff --git a/games/koala_seasons/koala_seasons.c b/games/koala_seasons/koala_seasons.c
new file mode 100644
index 00000000..6f484fe6
--- /dev/null
+++ b/games/koala_seasons/koala_seasons.c
@@ -0,0 +1,281 @@
+/*******************************************************************************************
+*
+* raylib - Koala Seasons game
+*
+* Koala Seasons is a runner, you must survive as long as possible jumping from tree to tree
+* Ready to start the adventure? How long can you survive?
+*
+* This game has been created using raylib 1.5 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+#include "screens/screens.h" // NOTE: Defines currentScreen
+
+#if defined(PLATFORM_WEB)
+ #include <emscripten/emscripten.h>
+#endif
+
+//----------------------------------------------------------------------------------
+// Global Variables Definition (local to this module)
+//----------------------------------------------------------------------------------
+static float transAlpha = 0;
+static bool onTransition = false;
+static bool transFadeOut = false;
+static int transFromScreen = -1;
+static int transToScreen = -1;
+static int framesCounter = 0;
+
+static Music music;
+
+//----------------------------------------------------------------------------------
+// Local Functions Declaration
+//----------------------------------------------------------------------------------
+void TransitionToScreen(int screen);
+void UpdateTransition(void);
+void DrawTransition(void);
+
+void UpdateDrawFrame(void); // Update and Draw one frame
+
+//----------------------------------------------------------------------------------
+// Main entry point
+//----------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
+{
+ // Initialization
+ //---------------------------------------------------------
+ const int screenWidth = 1280;
+ const int screenHeight = 720;
+ const char windowTitle[30] = "KOALA SEASONS";
+
+ //ShowLogo();
+ //SetConfigFlags(FLAG_FULLSCREEN_MODE);
+
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
+ InitWindow(screenWidth, screenHeight, windowTitle);
+#endif
+
+ // Load global data here (assets that must be available in all screens, i.e. fonts)
+ font = LoadSpriteFont("resources/graphics/mainfont.png");
+
+ atlas01 = LoadTexture("resources/graphics/atlas01.png");
+ atlas02 = LoadTexture("resources/graphics/atlas02.pvr");
+
+#if defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_ANDROID)
+ colorBlend = LoadShader("resources/shaders/glsl100/base.vs", "resources/shaders/glsl100/blend_color.fs");
+#else
+ colorBlend = LoadShader("resources/shaders/glsl330/base.vs", "resources/shaders/glsl330/blend_color.fs");
+#endif
+
+ InitAudioDevice();
+
+ // Load sounds data
+ fxJump = LoadSound("resources/audio/jump.ogg");
+ fxDash = LoadSound("resources/audio/dash.ogg");
+ fxEatLeaves = LoadSound("resources/audio/eat_leaves.ogg");
+ fxHitResin = LoadSound("resources/audio/resin_hit.ogg");
+ fxWind = LoadSound("resources/audio/wind_sound.ogg");
+ fxDieSnake = LoadSound("resources/audio/snake_die.ogg");
+ fxDieDingo = LoadSound("resources/audio/dingo_die.ogg");
+ fxDieOwl = LoadSound("resources/audio/owl_die.ogg");
+
+
+ music = LoadMusicStream("resources/audio/jngl.xm");
+ PlayMusicStream(music);
+ SetMusicVolume(music, 1.0f);
+
+ // Define and init first screen
+ // NOTE: currentScreen is defined in screens.h as a global variable
+ currentScreen = TITLE;
+
+ InitLogoScreen();
+ //InitOptionsScreen();
+ InitTitleScreen();
+ InitGameplayScreen();
+ InitEndingScreen();
+
+#if defined(PLATFORM_WEB)
+ emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
+#else
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) UpdateDrawFrame();
+#endif
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ UnloadEndingScreen();
+ UnloadTitleScreen();
+ UnloadGameplayScreen();
+ UnloadLogoScreen();
+
+ UnloadTexture(atlas01);
+ UnloadTexture(atlas02);
+ UnloadSpriteFont(font);
+
+ UnloadShader(colorBlend); // Unload color overlay blending shader
+
+ UnloadSound(fxJump);
+ UnloadSound(fxDash);
+ UnloadSound(fxEatLeaves);
+ UnloadSound(fxHitResin);
+ UnloadSound(fxWind);
+ UnloadSound(fxDieSnake);
+ UnloadSound(fxDieDingo);
+ UnloadSound(fxDieOwl);
+
+ UnloadMusicStream(music);
+
+ CloseAudioDevice(); // Close audio device
+
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+#if !defined(PLATFORM_ANDROID)
+ return 0;
+#endif
+}
+
+void TransitionToScreen(int screen)
+{
+ onTransition = true;
+ transFromScreen = currentScreen;
+ transToScreen = screen;
+}
+
+void UpdateTransition(void)
+{
+ if (!transFadeOut)
+ {
+ transAlpha += 0.05f;
+
+ if (transAlpha >= 1.0)
+ {
+ transAlpha = 1.0;
+ currentScreen = transToScreen;
+ transFadeOut = true;
+ framesCounter = 0;
+ }
+ }
+ else // Transition fade out logic
+ {
+ transAlpha -= 0.05f;
+
+ if (transAlpha <= 0)
+ {
+ transAlpha = 0;
+ transFadeOut = false;
+ onTransition = false;
+ transFromScreen = -1;
+ transToScreen = -1;
+ }
+ }
+}
+
+void DrawTransition(void)
+{
+ DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(BLACK, transAlpha));
+}
+
+// Update and Draw one frame
+void UpdateDrawFrame(void)
+{
+ // Update
+ //----------------------------------------------------------------------------------
+ if (!onTransition)
+ {
+ switch (currentScreen)
+ {
+ case LOGO:
+ {
+ UpdateLogoScreen();
+
+ if (FinishLogoScreen()) TransitionToScreen(TITLE);
+
+ } break;
+ case TITLE:
+ {
+ UpdateTitleScreen();
+
+ // NOTE: FinishTitleScreen() return an int defining the screen to jump to
+ if (FinishTitleScreen() == 1)
+ {
+ UnloadTitleScreen();
+ //currentScreen = OPTIONS;
+ //InitOptionsScreen();
+ }
+ else if (FinishTitleScreen() == 2)
+ {
+ UnloadTitleScreen();
+
+ InitGameplayScreen();
+ TransitionToScreen(GAMEPLAY);
+ }
+ } break;
+ case GAMEPLAY:
+ {
+ UpdateGameplayScreen();
+
+ if (FinishGameplayScreen())
+ {
+ UnloadGameplayScreen();
+
+ InitEndingScreen();
+ TransitionToScreen(ENDING);
+ }
+ } break;
+ case ENDING:
+ {
+ UpdateEndingScreen();
+
+ if (FinishEndingScreen())
+ {
+ UnloadEndingScreen();
+
+ InitGameplayScreen();
+ TransitionToScreen(GAMEPLAY);
+ }
+ } break;
+ default: break;
+ }
+ }
+ else UpdateTransition();
+
+ UpdateMusicStream(music);
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(WHITE);
+
+ switch (currentScreen)
+ {
+ case LOGO: DrawLogoScreen(); break;
+ case TITLE: DrawTitleScreen(); break;
+ case GAMEPLAY: DrawGameplayScreen(); break;
+ case ENDING: DrawEndingScreen(); break;
+ default: break;
+ }
+
+ if (onTransition) DrawTransition();
+
+ DrawFPS(20, GetScreenHeight() - 30);
+
+ DrawRectangle(GetScreenWidth() - 200, GetScreenHeight() - 50, 200, 40, Fade(WHITE, 0.6f));
+ DrawText("ALPHA VERSION", GetScreenWidth() - 180, GetScreenHeight() - 40, 20, DARKGRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+} \ No newline at end of file
diff --git a/games/koala_seasons/resources/audio/dash.ogg b/games/koala_seasons/resources/audio/dash.ogg
new file mode 100644
index 00000000..ef1089bc
--- /dev/null
+++ b/games/koala_seasons/resources/audio/dash.ogg
Binary files differ
diff --git a/games/koala_seasons/resources/audio/dingo_die.ogg b/games/koala_seasons/resources/audio/dingo_die.ogg
new file mode 100644
index 00000000..230bfca9
--- /dev/null
+++ b/games/koala_seasons/resources/audio/dingo_die.ogg
Binary files differ
diff --git a/games/koala_seasons/resources/audio/eat_leaves.ogg b/games/koala_seasons/resources/audio/eat_leaves.ogg
new file mode 100644
index 00000000..acdc71f2
--- /dev/null
+++ b/games/koala_seasons/resources/audio/eat_leaves.ogg
Binary files differ
diff --git a/games/koala_seasons/resources/audio/jngl.xm b/games/koala_seasons/resources/audio/jngl.xm
new file mode 100644
index 00000000..9136e750
--- /dev/null
+++ b/games/koala_seasons/resources/audio/jngl.xm
Binary files differ
diff --git a/games/koala_seasons/resources/audio/jump.ogg b/games/koala_seasons/resources/audio/jump.ogg
new file mode 100644
index 00000000..a7ccbacc
--- /dev/null
+++ b/games/koala_seasons/resources/audio/jump.ogg
Binary files differ
diff --git a/games/koala_seasons/resources/audio/owl_die.ogg b/games/koala_seasons/resources/audio/owl_die.ogg
new file mode 100644
index 00000000..dc9fa3d7
--- /dev/null
+++ b/games/koala_seasons/resources/audio/owl_die.ogg
Binary files differ
diff --git a/games/koala_seasons/resources/audio/resin_hit.ogg b/games/koala_seasons/resources/audio/resin_hit.ogg
new file mode 100644
index 00000000..6dc1ba5e
--- /dev/null
+++ b/games/koala_seasons/resources/audio/resin_hit.ogg
Binary files differ
diff --git a/games/koala_seasons/resources/audio/snake_die.ogg b/games/koala_seasons/resources/audio/snake_die.ogg
new file mode 100644
index 00000000..efadb1fa
--- /dev/null
+++ b/games/koala_seasons/resources/audio/snake_die.ogg
Binary files differ
diff --git a/games/koala_seasons/resources/audio/wind_sound.ogg b/games/koala_seasons/resources/audio/wind_sound.ogg
new file mode 100644
index 00000000..16ec4f63
--- /dev/null
+++ b/games/koala_seasons/resources/audio/wind_sound.ogg
Binary files differ
diff --git a/games/koala_seasons/resources/graphics/atlas01.png b/games/koala_seasons/resources/graphics/atlas01.png
new file mode 100644
index 00000000..5b59446a
--- /dev/null
+++ b/games/koala_seasons/resources/graphics/atlas01.png
Binary files differ
diff --git a/games/koala_seasons/resources/graphics/atlas02.png b/games/koala_seasons/resources/graphics/atlas02.png
new file mode 100644
index 00000000..05a5eca9
--- /dev/null
+++ b/games/koala_seasons/resources/graphics/atlas02.png
Binary files differ
diff --git a/games/koala_seasons/resources/graphics/mainfont.png b/games/koala_seasons/resources/graphics/mainfont.png
new file mode 100644
index 00000000..796b79be
--- /dev/null
+++ b/games/koala_seasons/resources/graphics/mainfont.png
Binary files differ
diff --git a/games/koala_seasons/resources/shaders/glsl100/base.vs b/games/koala_seasons/resources/shaders/glsl100/base.vs
new file mode 100644
index 00000000..b05d3463
--- /dev/null
+++ b/games/koala_seasons/resources/shaders/glsl100/base.vs
@@ -0,0 +1,25 @@
+#version 100
+
+// Input vertex attributes
+attribute vec3 vertexPosition;
+attribute vec2 vertexTexCoord;
+attribute vec4 vertexColor;
+
+// Input uniform values
+uniform mat4 mvpMatrix;
+
+// Output vertex attributes (to fragment shader)
+varying vec2 fragTexCoord;
+varying vec4 fragColor;
+
+// NOTE: Add here your custom variables
+
+void main()
+{
+ // Send vertex attributes to fragment shader
+ fragTexCoord = vertexTexCoord;
+ fragColor = vertexColor;
+
+ // Calculate final vertex position
+ gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
+} \ No newline at end of file
diff --git a/games/koala_seasons/resources/shaders/glsl100/blend_color.fs b/games/koala_seasons/resources/shaders/glsl100/blend_color.fs
new file mode 100644
index 00000000..eceb16be
--- /dev/null
+++ b/games/koala_seasons/resources/shaders/glsl100/blend_color.fs
@@ -0,0 +1,63 @@
+#version 100
+
+precision mediump float;
+
+// Input vertex attributes (from vertex shader)
+in vec2 fragTexCoord;
+in vec4 fragColor;
+
+// Input uniform values
+uniform sampler2D texture0;
+uniform vec4 colDiffuse;
+
+// NOTE: Add here your custom variables
+
+vec3 BlendOverlay(vec3 base, vec3 blend)
+{
+ float red;
+ float green;
+ float blue;
+
+ if (base.r < 0.5) red = 2.0*base.r*blend.r;
+ else red = 1.0 - 2.0*(1.0 - base.r)*(1.0 - blend.r);
+
+ if (base.g < 0.5) green = 2.0*base.g*blend.g;
+ else green = 1.0 - 2.0 *(1.0 - base.g)*(1.0 - blend.g);
+
+ if (base.b < 0.5) blue = 2.0*base.b*blend.b;
+ else blue = 1.0 - 2.0 *(1.0 - base.b)*(1.0 - blend.b);
+
+ return vec3(red, green, blue);
+}
+
+void main()
+{
+ // Blending Overlay
+ vec4 base = texture2D(texture0, fragTexCoord);
+
+ // No blending shader -> 64 FPS (1280x720)
+ //gl_FragColor = base*fragColor;
+
+ // Option01 -> 50 FPS (1280x720), 200 FPS (640x360)
+ vec3 final = BlendOverlay(base.rgb, fragColor.rgb);
+ gl_FragColor = vec4(final.rgb, base.a*fragColor.a);
+
+ // Option02 (Doesn't work) -> 63 FPS (1280x720)
+ //float luminance = (base.r*0.2126) + (base.g*0.7152) + (base.b*0.0722);
+ //gl_FragColor = vec4(tint*luminance, base.a);
+
+ // Option03 (no branches, precalculated ifs) -> 28 FPS (1280x720)
+ /*
+ vec4 blend = fragColor;
+ //if (base.a == 0.0) discard; // No improvement
+ vec3 br = clamp(sign(base.rgb - vec3(0.5)), vec3(0.0), vec3(1.0));
+ vec3 multiply = 2.0 * base.rgb * blend.rgb;
+ vec3 screen = vec3(1.0) - 2.0 * (vec3(1.0) - base.rgb)*(vec3(1.0) - blend.rgb);
+ vec3 overlay = mix(multiply, screen, br);
+ vec3 finalColor = mix(base.rgb, overlay, blend.a);
+ gl_FragColor = vec4(finalColor, base.a);
+ */
+
+ // Option04 (no branches, using built-in functions) -> 38 FPS (1280x720)
+ //gl_FragColor = vec4(mix(1 - 2*(1 - base.rgb)*(1 - tint), 2*base.rgb*tint, step(0.5, base.rgb)), base.a);
+}
diff --git a/games/koala_seasons/resources/shaders/glsl330/base.vs b/games/koala_seasons/resources/shaders/glsl330/base.vs
new file mode 100644
index 00000000..395cee1b
--- /dev/null
+++ b/games/koala_seasons/resources/shaders/glsl330/base.vs
@@ -0,0 +1,25 @@
+#version 330
+
+// Input vertex attributes
+in vec3 vertexPosition;
+in vec2 vertexTexCoord;
+in vec4 vertexColor;
+
+// Input uniform values
+uniform mat4 mvpMatrix;
+
+// Output vertex attributes (to fragment shader)
+out vec2 fragTexCoord;
+out vec4 fragColor;
+
+// NOTE: Add here your custom variables
+
+void main()
+{
+ // Send vertex attributes to fragment shader
+ fragTexCoord = vertexTexCoord;
+ fragColor = vertexColor;
+
+ // Calculate final vertex position
+ gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
+} \ No newline at end of file
diff --git a/games/koala_seasons/resources/shaders/glsl330/blend_color.fs b/games/koala_seasons/resources/shaders/glsl330/blend_color.fs
new file mode 100644
index 00000000..de3fd2bc
--- /dev/null
+++ b/games/koala_seasons/resources/shaders/glsl330/blend_color.fs
@@ -0,0 +1,64 @@
+#version 330
+
+// Input vertex attributes (from vertex shader)
+in vec2 fragTexCoord;
+in vec4 fragColor;
+
+// Input uniform values
+uniform sampler2D texture0;
+uniform vec4 colDiffuse;
+
+// Output fragment color
+out vec4 finalColor;
+
+// NOTE: Add here your custom variables
+
+vec3 BlendOverlay(vec3 base, vec3 blend)
+{
+ float red;
+ float green;
+ float blue;
+
+ if (base.r < 0.5) red = 2.0*base.r*blend.r;
+ else red = 1.0 - 2.0*(1.0 - base.r)*(1.0 - blend.r);
+
+ if (base.g < 0.5) green = 2.0*base.g*blend.g;
+ else green = 1.0 - 2.0 *(1.0 - base.g)*(1.0 - blend.g);
+
+ if (base.b < 0.5) blue = 2.0*base.b*blend.b;
+ else blue = 1.0 - 2.0 *(1.0 - base.b)*(1.0 - blend.b);
+
+ return vec3(red, green, blue);
+}
+
+void main()
+{
+ // Blending Overlay
+ vec4 base = texture2D(texture0, fragTexCoord);
+
+ // No blending shader -> 64 FPS (1280x720)
+ //gl_FragColor = base*tintColor;
+
+ // Option01 -> 50 FPS (1280x720), 200 FPS (640x360)
+ vec3 final = BlendOverlay(base.rgb, fragColor.rgb);
+ finalColor = vec4(final.rgb, base.a*fragColor.a);
+
+ // Option02 (Doesn't work) -> 63 FPS (1280x720)
+ //float luminance = (base.r*0.2126) + (base.g*0.7152) + (base.b*0.0722);
+ //gl_FragColor = vec4(tintColor.rgb*luminance, base.a);
+
+ // Option03 (no branches, precalculated ifs) -> 28 FPS (1280x720)
+ /*
+ vec4 blend = tintColor;
+ //if (base.a == 0.0) discard; // No improvement
+ vec3 br = clamp(sign(base.rgb - vec3(0.5)), vec3(0.0), vec3(1.0));
+ vec3 multiply = 2.0 * base.rgb * blend.rgb;
+ vec3 screen = vec3(1.0) - 2.0 * (vec3(1.0) - base.rgb)*(vec3(1.0) - blend.rgb);
+ vec3 overlay = mix(multiply, screen, br);
+ vec3 finalColor = mix(base.rgb, overlay, blend.a);
+ gl_FragColor = vec4(finalColor, base.a);
+ */
+
+ // Option04 (no branches, using built-in functions) -> 38 FPS (1280x720)
+ //gl_FragColor = vec4(mix(1 - 2*(1 - base.rgb)*(1 - tintColor.rgb), 2*base.rgb*tintColor.rgb, step(0.5, base.rgb)), base.a);
+}
diff --git a/games/koala_seasons/screens/atlas01.h b/games/koala_seasons/screens/atlas01.h
new file mode 100644
index 00000000..0c963d4c
--- /dev/null
+++ b/games/koala_seasons/screens/atlas01.h
@@ -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 }
diff --git a/games/koala_seasons/screens/atlas02.h b/games/koala_seasons/screens/atlas02.h
new file mode 100644
index 00000000..dfae117a
--- /dev/null
+++ b/games/koala_seasons/screens/atlas02.h
@@ -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 }
diff --git a/games/koala_seasons/screens/screen_ending.c b/games/koala_seasons/screens/screen_ending.c
new file mode 100644
index 00000000..125720bc
--- /dev/null
+++ b/games/koala_seasons/screens/screen_ending.c
@@ -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;
+} \ No newline at end of file
diff --git a/games/koala_seasons/screens/screen_gameplay.c b/games/koala_seasons/screens/screen_gameplay.c
new file mode 100644
index 00000000..0d1938b8
--- /dev/null
+++ b/games/koala_seasons/screens/screen_gameplay.c
@@ -0,0 +1,3937 @@
+/**********************************************************************************************
+*
+* raylib - Koala Seasons game
+*
+* Gameplay 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.
+*
+**********************************************************************************************/
+
+//----------------------------------------------------------------------------------
+// Defines and Macros
+//----------------------------------------------------------------------------------
+#include "raylib.h"
+#include "screens.h"
+
+#include <time.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "atlas01.h"
+#include "atlas02.h"
+
+//#define DEBUG
+
+// DONE: Review MAX_* limits, don't waste memory!!!
+#define MAX_ENEMIES 16
+#define MAX_BAMBOO 16
+#define MAX_LEAVES 14
+#define MAX_FIRE 10
+#define MAX_FIRE_FLAMES 20
+#define MAX_ICE 10
+#define MAX_RESIN 10
+#define MAX_WIND 10
+#define MAX_PARTICLES 128
+#define MAX_PARTICLES_RAY 8
+#define MAX_PARTICLES_SPEED 64
+#define MAX_PARTICLES_STORM 512
+
+#define SPEED 3*TIME_FACTOR // Speed of koala, trees, enemies, ...
+#define JUMP 15*TIME_FACTOR // Jump speed
+#define FLYINGMOV 10*TIME_FACTOR // Up and Down speed when final form
+#define GRAVITY 1*TIME_FACTOR // Gravity when grabbed to tree
+#define ICEGRAVITY 4*TIME_FACTOR // Gravity when grabbed to an icy tree
+#define KICKSPEED 3*TIME_FACTOR // Gravity when kicking
+#define SEASONCHANGE 1200 // Frames duration per season
+#define SEASONTRANSITION SEASONCHANGE/6 // Season transition time
+
+//SPAWNCHANCE - Chance of spawning things everytime a tree spawns
+#define ICESPAWNCHANCE 30 // Chance of spawning ice everytime a tree spawns
+#define RESINSPAWNCHANCE 30 // Chance of spawning resin everytime a tree spawns
+#define FIRESPAWNCHANCE 30 // Chance of spawning fire everytime a tree spawns
+#define WINDSPAWNCHANCE 30 // Chance of spawning wind everytime a tree spawns
+
+//ENEMYSPAWNCHANCE - Chance of spawning enemies everytime a tree spawns
+#define DINGOSPAWNCHANCE 30 // Chance of spawning dingos everytime a tree spawns
+#define OWLSPAWNCHANCE 30 // Chance of spawning owls everytime a tree spawns
+#define SNAKESPAWNCHANCE 30 // Chance of spawning snakes everytime a tree spawns
+#define BEE_SPAWNCHANCE 10 // Chance of spawning bees everytime a tree spawns
+#define EAGLE_SPAWNCHANCE 5 // Chance of spawning eagles everytime a tree spawns
+
+#define EAGLE_TIME_DELAY 600
+
+//SCORE - Score increase everytime an enemy is killed
+#define DINGOSCORE 100 // Score increase everytime a dingo is killed
+#define OWLSCORE 100 // Score increase everytime an owl is killed
+#define SNAKESCORE 100 // Score increase everytime a snake is killed
+#define BEESCORE 300 // Score increase everytime a bee is killed
+#define EAGLESCORE 300 // Score increase everytime an eagle is killed
+
+#define LEAVESTOTRANSFORM 100 // Number of leaves recquired for the transformation
+#define MAXTIMESPAWN 85 // Maximum time for tree spawn
+#define MINTIMESPAWN 35 // Minimum time for tree spawn
+#define STARTINGMONTH 0 // Starting month (0 = January (summer))
+
+#define PROGRESION_START 3600 // Time to start the progresion
+#define PROGRESION_DURATION 12000 // Maximum time
+#define PROGRESOIN_MAX_SPAWNCHANCE 30 // Maximum spawn chance increase
+#define PROGRESION_MAX_SPEED 0.5 // Maximum speed modification by progresion
+
+//----------------------------------------------------------------------------------
+// Types and Structures Definition
+//----------------------------------------------------------------------------------
+typedef enum { WINTER, SPRING, SUMMER, FALL, TRANSITION} SeasonState;
+typedef enum { JUMPING, KICK, FINALFORM, GRABED, ONWIND } KoalaState;
+
+typedef struct {
+ Vector2 position;
+ Vector2 speed;
+ float rotation;
+ float size;
+ Color color;
+ float alpha;
+ float rotPhy;
+ bool active;
+} Particle;
+
+typedef struct {
+ Vector2 position;
+ Vector2 speed;
+ float rotation;
+ Vector2 size;
+ Color color;
+ float alpha;
+ bool active;
+} ParticleSpeed;
+
+typedef struct {
+ Vector2 position;
+ Color color;
+ float alpha;
+ float size;
+ float rotation;
+ bool active; // NOTE: Use it to activate/deactive particles
+ bool fading;
+ float delayCounter;
+} ParticleRay;
+
+typedef struct {
+ Vector2 position;
+ bool active;
+ int spawnTime;
+ int maxTime;
+ Particle particles[MAX_PARTICLES];
+} ParticleSystem;
+
+// DONE: Rename for coherence: ParticleSystemStorm
+typedef struct {
+ Vector2 position;
+ bool active;
+ int spawnTime;
+ int maxTime;
+ Particle particles[MAX_PARTICLES_STORM];
+} ParticleSystemStorm;
+
+typedef struct {
+ Vector2 position;
+ bool active;
+ float alpha;
+ float scale;
+ int score;
+} PopUpScore;
+
+typedef struct {
+ Vector2 position;
+ bool active;
+ int spawnTime;
+ int maxTime;
+ ParticleSpeed particle[MAX_PARTICLES_SPEED];
+} ParticleSystemSpeed;
+
+typedef struct {
+ Vector2 position;
+ bool active;
+ int spawnTime;
+ int maxTime;
+ ParticleRay particles[MAX_PARTICLES_RAY];
+} ParticleSystemRay;
+
+//----------------------------------------------------------------------------------
+// Global Variables Definition (local to this module)
+//----------------------------------------------------------------------------------
+static float gravity;
+static SeasonState season;
+static KoalaState state;
+
+// Gameplay screen global variables
+static int framesCounter;
+static int finishScreen;
+static int grabCounter;
+static int velocity;
+static int speed;
+static int bambooTimer;
+static int bambooSpawnTime;
+static int colorTimer;
+static int jumpSpeed;
+static int power;
+static int maxPower;
+static int transCount;
+static int posArray[2];
+static int posArrayDingo[2];
+static int enemyVel[MAX_ENEMIES];
+static int beeVelocity;
+static int fireSpeed;
+static int windCounter;
+static int seasonTimer;
+static int seasonChange;
+static int resinCountjump;
+static int resinCountdrag;
+static int resinCount;
+static int currentMonth;
+static int monthTimer;
+static int monthChange;
+static int initMonth;
+static int fireCounter[MAX_FIRE];
+static int fireOffset;
+static int beeMov;
+static int killCounter;
+static int leafType[MAX_LEAVES];
+static int posArrayLeaf[3];
+static int transAniCounter;
+static int globalFrameCounter;
+static int startCounter;
+static int animCounter;
+static int startNum = 3;
+static int finalFormEnd;
+static int randomMessage;
+static int parallaxBackOffset;
+static int parallaxFrontOffset;
+
+// Animation Variables
+static int thisFrame = 1;
+static int currentFrame = 0;
+static int thisFrameWind = 1;
+static int currentFrameWind = 0;
+static int thisFrameBee = 1;
+static int thisFrameSnake = 1;
+static int thisFrameDingo = 1;
+static int thisFrameOwl = 1;
+static int thisFrameEagle = 1;
+static int curFrameEagle;
+static int curFrameBee = 0;
+static int curFrameSnake = 0;
+static int curFrameDingo = 0;
+static int curFrameOwl = 0;
+static int curFrame;
+static int curFrame1;
+static int curFrame2;
+static int curFrame3;
+static int transitionFramesCounter;
+static int thisFrameKoala;
+static int curFrameKoala;
+static int fogSpeed;
+static int fogPosition;
+static int progresionDelay;
+static int progresionFramesCounter;
+static int initLeaves;
+static int eagleDelay;
+
+// Stage data variables
+static int jumpCounter;
+static int resinCounter;
+static int tornadoCounter;
+static int dashCounter;
+static int superKoalaCounter;
+
+// Global data variables
+static int snakeKillCounter;
+static int dingoKillCounter;
+static int owlKillCounter;
+static int beeKillCounter;
+static int eagleKillCounter;
+static int globalKillCounter;
+static int deathsCounter;
+
+static float scrollFront;
+static float scrollMiddle;
+static float scrollBack;
+static float scrollSpeed;
+static float rightAlpha = 0.5;
+static float leftAlpha = 0.5;
+static float speedMod;
+static float groundPos;
+static float transRotation;
+static float clockRotation;
+static float clockSpeedRotation;
+static float numberAlpha;
+static float numberScale;
+static float fogAlpha;
+static float speedIncrease;
+static float speedProgresion;
+static float progresionSpawnChance;
+static float UIfade;
+static float filterAlpha;
+static float leafGUIglowFade;
+static float leafGUIpulseFade;
+static float leafGUIpulseScale;
+static float clockInitRotation;
+static float clockFinalRotation;
+
+// Game text strings
+const char textFinalForm[32] = "THIS ISN'T EVEN MY FINAL FORM!";
+const char textSpring1[32] = "FLOWER POWER!";
+const char textSummer1[32] = "PREPARE FOR THE SUMMER!";
+const char textFall1[32] = "HERE COMES THE FALL!";
+const char textWinter1[32] = "WINTER IS COMING!";
+const char textSpring2[32] = "POLLEN IS IN THE AIR";
+const char textSummer2[32] = "HAPPY NEW YEAR!";
+const char textFall2[32] = "IT'S RAINING RAIN";
+const char textWinter2[32] = "LET IT SNOW!";
+
+static bool snakeActive[MAX_ENEMIES];
+static bool dingoActive[MAX_ENEMIES];
+static bool owlActive[MAX_ENEMIES];
+static bool branchActive[MAX_ENEMIES];
+static bool bambooActive[MAX_BAMBOO];
+static bool leafActive[MAX_LEAVES];
+static bool fireActive[MAX_FIRE];
+static bool iceActive[MAX_ICE];
+static bool windActive[MAX_WIND];
+static bool resinActive[MAX_RESIN];
+static bool isHitSnake[MAX_ENEMIES];
+static bool isHitDingo[MAX_ENEMIES];
+static bool isHitOwl[MAX_ENEMIES];
+static bool isHitBee;
+static bool isHitEagle;
+static bool onFire[MAX_FIRE];
+static bool onIce;
+static bool onResin;
+static bool playerActive;
+static bool play;
+static bool transforming;
+static bool onWind;
+static bool glowing;
+static bool beeActive;
+static bool eagleActive;
+static bool eagleAlert;
+static bool alertActive;
+static bool alertBeeActive;
+static bool coolDown;
+static bool leafSide[MAX_LEAVES];
+static bool transBackAnim;
+static bool fog;
+static bool leafGUIglow;
+
+static Rectangle player = {0, 0, 0, 0};
+static Rectangle leftButton = {0, 0, 0, 0};
+static Rectangle rightButton = {0, 0, 0, 0};
+static Rectangle powerButton = {0, 0, 0, 0};
+static Rectangle fire[MAX_FIRE];
+//static Rectangle flames[MAX_FLAMES];
+static Rectangle ice[MAX_ICE];
+static Rectangle resin[MAX_RESIN];
+static Rectangle wind[MAX_WIND];
+static Rectangle bamboo[MAX_BAMBOO];
+static Rectangle snake[MAX_ENEMIES];
+static Rectangle dingo[MAX_ENEMIES];
+static Rectangle owl[MAX_ENEMIES];
+static Rectangle leaf[MAX_LEAVES]; // DONE: Review name!
+static Rectangle powerBar;
+static Rectangle backBar;
+static Rectangle fireAnimation;
+static Rectangle windAnimation;
+static Rectangle beeAnimation;
+static Rectangle snakeAnimation;
+static Rectangle dingoAnimation;
+static Rectangle owlAnimation;
+static Rectangle bee;
+static Rectangle eagle;
+static Rectangle eagleAnimation;
+static Rectangle koalaAnimationIddle;
+static Rectangle koalaAnimationJump;
+static Rectangle koalaAnimationFly;
+static Rectangle koalaAnimationTransform;
+static Rectangle alertRectangle;
+static Rectangle beeAlertRectangle;
+
+static time_t rawtime;
+static struct tm *ptm;
+
+static Color finalColor;
+static Color finalColor2;
+static Color flyColor;
+static Color counterColor;
+static Color color00, color01, color02, color03;
+static Color initcolor00, initcolor01, initcolor02, initcolor03;
+static Color finalcolor00, finalcolor01, finalcolor02, finalcolor03;
+static Vector2 zero;
+static Vector2 firePos;
+static Vector2 branchPos[MAX_ENEMIES];
+static Vector2 textSize;
+static Vector2 clockPosition;
+
+static Particle enemyHit[MAX_ENEMIES];
+static ParticleSystem leafParticles[MAX_LEAVES]; // DONE: Review!!! Creating 40 ParticleSystem!!! -> 40*128 = 5120 Particles! Maybe better create a struct Leaf?
+static ParticleSystem snowParticle;
+static ParticleSystem backSnowParticle;
+static ParticleSystem dandelionParticle;
+static ParticleSystem dandelionBackParticle;
+static ParticleSystem planetreeParticle;
+static ParticleSystem backPlanetreeParticle;
+static ParticleSystem flowerParticle;
+static ParticleSystem backFlowerParticle;
+static ParticleSystem rainParticle;
+static ParticleSystem backRainParticle;
+static ParticleSystemStorm rainStormParticle;
+static ParticleSystemStorm snowStormParticle;
+static ParticleSystemRay rayParticles;
+static ParticleSystemRay backRayParticles;
+static ParticleSystemSpeed speedFX;
+static PopUpScore popupScore[MAX_ENEMIES];
+static PopUpScore popupLeaves[MAX_LEAVES];
+static PopUpScore popupBee;
+static PopUpScore popupEagle;
+
+//----------------------------------------------------------------------------------
+// Module specific Functions Declaration
+//----------------------------------------------------------------------------------
+static void BambooSpawn(void);
+static void SnakeSpawn(int chance);
+static void DingoSpawn(int chance);
+static void OwlSpawn(int chance);
+static void BeeSpawn(int chance);
+static void EagleSpawn(int chance);
+static void FireSpawn(int chance);
+static void IceSpawn(int chance);
+static void ResinSpawn(int chance);
+static void WindSpawn(int chance);
+static void LeafSpawn(void);
+
+static void DrawParallaxFront(void);
+static void DrawParallaxMiddle(void);
+static void DrawParallaxBack(void);
+static float LinearEaseIn(float t, float b, float c, float d);
+
+static Color ColorTransition(Color initialColor, Color finalColor, int framesCounter);
+static bool CheckArrayValue(int *array, int arrayLength, int value);
+
+static void Reset(void);
+
+//----------------------------------------------------------------------------------
+// Gameplay Screen Functions Definition
+//----------------------------------------------------------------------------------
+
+// Gameplay Screen Initialization logic
+void InitGameplayScreen(void)
+{
+ // Get current time at the moment of running game
+ time(&rawtime);
+ ptm = gmtime(&rawtime);
+
+ currentMonth = ptm->tm_mon;
+ initMonth = ptm->tm_mon;
+ years = 1900 + ptm->tm_year;
+
+ Reset();
+}
+
+// Gameplay Screen Update logic
+void UpdateGameplayScreen(void)
+{
+ //if ((IsKeyPressed(KEY_SPACE) || IsMouseButtonPressed(0)) && playerActive) play = true;
+
+ if (play == false && playerActive)
+ {
+ startCounter+= 1*TIME_FACTOR;
+
+ if (startCounter > 20 && startCounter < 110)
+ {
+ animCounter+=1*TIME_FACTOR;
+ numberAlpha -= 0.033f*TIME_FACTOR;
+ numberScale -= 0.0825f*TIME_FACTOR;
+
+ if (animCounter <= 30) startNum = 3;
+ else if (animCounter > 30 && animCounter <= 60) startNum = 2;
+ else startNum = 1;
+ }
+ else if (startCounter >= 110) play = true;
+
+ if (numberAlpha <= 0) numberAlpha = 1;
+ if (numberScale <= 0) numberScale = 2.5f;
+
+ textSize = MeasureTextEx(font, FormatText("%01i", startNum), font.size*numberScale, 2);
+ }
+
+ if (playerActive) finishScreen = 0;
+
+ if (play && playerActive)
+ {
+ seasonTimer += speedMod*TIME_FACTOR;
+ monthTimer += speedMod*TIME_FACTOR;
+ eagleDelay += speedMod*TIME_FACTOR;
+
+ globalFrameCounter++;
+
+ if (monthTimer >= monthChange)
+ {
+ if ((currentMonth == 10))
+ {
+ clockInitRotation = 225;
+ clockFinalRotation = clockInitRotation + 90;
+ rainChance = GetRandomValue(0, 100);
+ clockSpeedRotation = 0;
+ seasons++;
+ }
+ else if (currentMonth == 1)
+ {
+ clockInitRotation = 315;
+ clockFinalRotation = clockInitRotation + 90;
+ rainChance = GetRandomValue(0, 100);
+ clockSpeedRotation = 0;
+ seasons++;
+ }
+ else if (currentMonth == 4)
+ {
+ clockInitRotation = 45;
+ clockFinalRotation = clockInitRotation + 90;
+ rainChance = GetRandomValue(0, 100);
+ clockSpeedRotation = 0;
+ seasons++;
+ }
+ else if (currentMonth == 7)
+ {
+ clockInitRotation = 135;
+ clockFinalRotation = clockInitRotation + 90;
+ rainChance = GetRandomValue(0, 100);
+ clockSpeedRotation = 0;
+ seasons++;
+ }
+
+ currentMonth++;
+ monthTimer = 0;
+
+ //EagleSpawn();
+ }
+
+ if (currentMonth > 11)
+ {
+ currentMonth = 0;
+ years++;
+ }
+
+ if ((currentMonth == 11) || (currentMonth == 0) || ((currentMonth == 1) && (monthTimer <= SEASONTRANSITION)))
+ {
+ dandelionParticle.active = true;
+ dandelionBackParticle.active = true;
+ rayParticles.active = true;
+ backRayParticles.active = true;
+
+ transitionFramesCounter = 0;
+ randomMessage = GetRandomValue(0, 10);
+
+ fog = false;
+
+ initcolor00 = color00; // Summer Color
+ initcolor01 = color01;
+ initcolor02 = color02;
+ initcolor03 = color03;
+ finalcolor00 = (Color){242, 113, 62, 255}; // Fall Autum
+ finalcolor01 = (Color){190, 135, 114, 255};
+ finalcolor02 = (Color){144, 130, 101, 255};
+ finalcolor03 = (Color){214, 133, 58, 255};
+ season = SUMMER;
+ currentSeason = 0;
+ }
+ else if ((currentMonth == 2) || (currentMonth == 3) || ((currentMonth == 4) && (monthTimer <= SEASONTRANSITION)))
+ {
+ if ((rainChance <= 40) && (rainChance > 24))
+ {
+ //rainParticle.active = true;
+ rainStormParticle.active = true;
+ backRainParticle.active = false;
+ fog = true;
+ }
+ else if (rainChance <= 24)
+ {
+ //rainParticle.active = true;
+ rainStormParticle.active = true;
+ backRainParticle.active = false;
+ fog = true;
+ }
+ else
+ {
+ planetreeParticle.active = true;
+ backPlanetreeParticle.active = true;
+ fog = false;
+ }
+
+ transitionFramesCounter = 0;
+ randomMessage = GetRandomValue(0, 10);
+
+ initcolor00 = color00; // Fall Color
+ initcolor01 = color01;
+ initcolor02 = color02;
+ initcolor03 = color03;
+ finalcolor00 = (Color){130, 130, 181, 255}; // Winter Autum
+ finalcolor01 = (Color){145, 145, 166, 255};
+ finalcolor02 = (Color){104, 142, 144, 255};
+ finalcolor03 = (Color){57, 140, 173, 255};
+
+ season = FALL;
+ currentSeason = 1;
+ }
+ else if ((currentMonth == 5) || (currentMonth == 6) || ((currentMonth == 7) && (monthTimer <= SEASONTRANSITION)))
+ {
+ if (rainChance <= 40)
+ {
+ //rainParticle.active = true;
+ snowStormParticle.active = true;
+ backSnowParticle.active = true;
+ fog = true;
+ }
+ else
+ {
+ snowParticle.active = true;
+ backSnowParticle.active = true;
+ fog = false;
+ }
+
+ transitionFramesCounter = 0;
+ randomMessage = GetRandomValue(0, 10);
+
+ initcolor00 = color00; // Winter Color
+ initcolor01 = color01;
+ initcolor02 = color02;
+ initcolor03 = color03;
+ finalcolor00 = (Color){196, 176, 49, 255}; // Spring Autum
+ finalcolor01 = (Color){178, 163, 67, 255};
+ finalcolor02 = (Color){133, 143, 90, 255};
+ finalcolor03 = (Color){133, 156, 42, 255};
+
+ season = WINTER;
+ currentSeason = 2;
+ }
+ else if ((currentMonth == 8) || (currentMonth == 9) || ((currentMonth == 10) && (monthTimer <= SEASONTRANSITION)))
+ {
+ flowerParticle.active = true;
+ backFlowerParticle.active = true;
+
+ transitionFramesCounter = 0;
+ randomMessage = GetRandomValue(0, 9);
+
+ fog = false;
+
+ initcolor00 = color00; // Spring Color
+ initcolor01 = color01;
+ initcolor02 = color02;
+ initcolor03 = color03;
+ finalcolor00 = (Color){129, 172, 86, 255}; // Summer Autum
+ finalcolor01 = (Color){145, 165, 125, 255};
+ finalcolor02 = (Color){161, 130, 73, 255};
+ finalcolor03 = (Color){198, 103, 51, 255};
+
+ season = SPRING;
+ currentSeason = 3;
+ }
+ else
+ {
+ flowerParticle.active = false;
+ backFlowerParticle.active = false;
+ snowParticle.active = false;
+ backSnowParticle.active = false;
+ planetreeParticle.active = false;
+ backPlanetreeParticle.active = false;
+ dandelionParticle.active = false;
+ dandelionBackParticle.active = false;
+ rainParticle.active = false;
+ rainStormParticle.active = false;
+ backRainParticle.active = false;
+ rayParticles.active = false;
+ backRayParticles.active = false;
+ snowStormParticle.active = false;
+
+ fog = false;
+
+ transitionFramesCounter += speedMod*TIME_FACTOR;
+
+ if(transitionFramesCounter <= SEASONTRANSITION)
+ {
+ color00 = ColorTransition(initcolor00, finalcolor00, transitionFramesCounter);
+ color01 = ColorTransition(initcolor01, finalcolor01, transitionFramesCounter);
+ color02 = ColorTransition(initcolor02, finalcolor02, transitionFramesCounter);
+ color03 = ColorTransition(initcolor03, finalcolor03, transitionFramesCounter);
+ }
+
+ season = TRANSITION;
+ }
+
+ // Update scrolling values
+ if (!transforming)
+ {
+ scrollFront -= scrollSpeed;
+ scrollMiddle -= (scrollSpeed*0.75f);
+ scrollBack -= scrollSpeed/2;
+
+ fogPosition -= fogSpeed;
+
+ groundPos -= speed;
+ clockRotation += clockSpeedRotation;
+ }
+
+ player.y += gravity;
+ bambooTimer += (speedMod*TIME_FACTOR);
+ speed = SPEED*speedMod;
+
+ if (player.x >= GetScreenWidth()*0.6 && state != FINALFORM)
+ {
+ speedIncrease = (player.x - GetScreenWidth()*0.6f)/GetScreenWidth();
+ }
+ else if (player.x < GetScreenWidth()*0.6 && state != FINALFORM)
+ {
+ speedIncrease = 0;
+ }
+
+ if (state != FINALFORM) speedMod = 1.2 + speedIncrease + speedProgresion;
+
+ progresionDelay++;
+
+ if (progresionDelay >= PROGRESION_START)
+ {
+ progresionFramesCounter++;
+
+ if (progresionFramesCounter < PROGRESION_DURATION)
+ {
+ speedProgresion = LinearEaseIn((float)progresionFramesCounter, 0.0f, (float)PROGRESION_MAX_SPEED, (float)PROGRESION_DURATION);
+ progresionSpawnChance = LinearEaseIn((float)progresionFramesCounter, 0.0f, (float)PROGRESOIN_MAX_SPAWNCHANCE, (float)PROGRESION_DURATION);
+ }
+ }
+
+ if (scrollFront <= -GetScreenWidth()) scrollFront = 0;
+ if (scrollMiddle <= -GetScreenWidth()) scrollMiddle = 0;
+ if (scrollBack <= -GetScreenWidth()) scrollBack = 0;
+ if (groundPos <= -GetScreenWidth()) groundPos = 0;
+ if (fogPosition <= -GetScreenWidth()) fogPosition = 0;
+
+ if (fogAlpha > 0 && !fog) fogAlpha -= 0.03f*speedMod;
+ else if (fog && fogAlpha < 1) fogAlpha += 0.03f*speedMod;
+
+ if (filterAlpha > 0 && !fog) filterAlpha -= 0.02f*speedMod;
+ else if (fog && filterAlpha < 0.15f) filterAlpha += 0.02f*speedMod;
+
+ //if (state != FINALFORM) clockSpeedRotation = (float)((90/(float)seasonChange)*speedMod)*1.75;
+ clockSpeedRotation += speedMod*TIME_FACTOR;
+
+ if (clockSpeedRotation <= (SEASONCHANGE)) clockRotation = (float)LinearEaseIn((float)clockSpeedRotation, clockInitRotation, 90.0f, (float)(SEASONCHANGE));
+ else clockRotation = clockFinalRotation;
+
+ if (CheckCollisionCircleRec(clockPosition, gameplay_gui_seasonsclock_disc.width, player))
+ {
+ if (UIfade > 0.4f) UIfade -= 0.01f*TIME_FACTOR;
+ }
+ else
+ {
+ if (UIfade < 1) UIfade += 0.01f*TIME_FACTOR;
+ }
+
+ //----------------------------------------------------------------------------------
+ // Animations
+ //----------------------------------------------------------------------------------
+
+ // Wind Animation
+ thisFrameWind += 1*TIME_FACTOR;
+
+ if (thisFrameWind >= 12)
+ {
+ currentFrameWind++;
+ thisFrameWind = 0;
+ }
+
+ if (currentFrameWind > 3) currentFrameWind = 0;
+
+ windAnimation.x = gameplay_props_whirlwind_spritesheet.x + windAnimation.width*currentFrameWind;
+
+ // Fire Animation
+ thisFrame += 1*TIME_FACTOR;
+
+ if (thisFrame >= 8)
+ {
+ curFrame++;
+ curFrame1++;
+ curFrame2++;
+ curFrame3++;
+
+ thisFrame = 0;
+ }
+
+ if (curFrame > 3) curFrame = 0;
+ if (curFrame1 > 3) curFrame1 = 0;
+ if (curFrame2 > 3) curFrame2 = 0;
+ if (curFrame3 > 3) curFrame3 = 0;
+
+ if (!transforming)
+ {
+ // Eagle Animation
+ curFrameEagle += 1*TIME_FACTOR;
+
+ if (curFrameEagle >= 6*TIME_FACTOR)
+ {
+ thisFrameEagle ++;
+ curFrameEagle = 0;
+ }
+
+ if (thisFrameEagle > 1) thisFrameEagle = 0;
+
+ eagleAnimation.x = gameplay_enemy_eagle.x + eagleAnimation.width*thisFrameEagle;
+
+ // Bee Animation
+ curFrameBee += 1*TIME_FACTOR;
+
+ if (curFrameBee >= 3*TIME_FACTOR)
+ {
+ thisFrameBee ++;
+ curFrameBee = 0;
+ }
+
+ if (thisFrameBee > 3) thisFrameBee = 0;
+
+ beeAnimation.x = gameplay_enemy_bee.x + beeAnimation.width*thisFrameBee;
+
+ // Snake Animation
+ thisFrameSnake += 1*TIME_FACTOR;
+
+ if (thisFrameSnake >= 24*TIME_FACTOR)
+ {
+ curFrameSnake ++;
+ thisFrameSnake = 0;
+ }
+
+ if (curFrameSnake > 1) curFrameSnake = 0;
+
+ snakeAnimation.x = gameplay_enemy_snake.x + snakeAnimation.width*curFrameSnake;
+
+ // Dingo Animation
+ curFrameDingo += 1*TIME_FACTOR;
+
+ if (curFrameDingo >= 24*TIME_FACTOR)
+ {
+ thisFrameDingo ++;
+ curFrameDingo = 0;
+ }
+
+ if (thisFrameDingo > 1) thisFrameDingo = 0;
+
+ dingoAnimation.x = gameplay_enemy_dingo.x + dingoAnimation.width*thisFrameDingo;
+
+ // Owl Animation
+ curFrameOwl += 1*TIME_FACTOR;
+
+ if (curFrameOwl >= 24*TIME_FACTOR)
+ {
+ thisFrameOwl ++;
+ curFrameOwl = 0;
+ }
+
+ if (thisFrameOwl > 1) thisFrameOwl = 0;
+
+ owlAnimation.x = gameplay_enemy_owl.x + owlAnimation.width*thisFrameOwl;
+
+ // Alert Animation
+ if (alertActive)
+ {
+ if (eagleAlert)
+ {
+ alertRectangle.x -= 100*TIME_FACTOR;
+ alertRectangle.width += 100*TIME_FACTOR;
+ alertRectangle.height += 5*TIME_FACTOR;
+ alertRectangle.y -= 5*TIME_FACTOR;
+
+ if (alertRectangle.height >= 100) eagleAlert = false;
+ }
+ else
+ {
+ alertRectangle.height -= 1*TIME_FACTOR;
+ alertRectangle.y += 1*TIME_FACTOR;
+
+ if (alertRectangle.height <= 0)
+ {
+ eagleAlert = true;
+ eagleActive = true;
+ alertActive = false;
+ }
+ }
+ }
+
+ // Eagle Logic
+ if (eagleActive == true && !isHitEagle)
+ {
+ eagle.x -= 10*speed*TIME_FACTOR;
+
+ if (CheckCollisionRecs(eagle, player) && (state != FINALFORM) && (state != KICK))
+ {
+ velocity = 8;
+ jumpSpeed = 2;
+ play = false;
+ playerActive = false;
+ killer = 6;
+ }
+ else if (CheckCollisionRecs(eagle, player) && (state == FINALFORM) && (state != KICK))
+ {
+ isHitEagle = true;
+ beeVelocity = 8;
+ killHistory[killCounter] = 5;
+ killCounter++;
+
+ score += EAGLESCORE;
+ eagleKillCounter++;
+ globalKillCounter++;
+
+ popupEagle.position = (Vector2){ eagle.x, eagle.y };
+ popupEagle.scale = 1.0f;
+ popupEagle.alpha = 1.0f;
+ popupEagle.score = EAGLESCORE;
+ popupEagle.active = true;
+ }
+ }
+ else if (isHitEagle)
+ {
+ if ((eagle.y + eagle.height) > GetScreenHeight())
+ {
+ eagleActive = false;
+ isHitEagle = false;
+ }
+
+ eagle.x += 2*TIME_FACTOR;
+ beeVelocity -= 1*TIME_FACTOR*TIME_FACTOR;
+ eagle.y -= beeVelocity*TIME_FACTOR;
+ }
+
+ if (eagle.x + eagle.width <= 0) eagleActive = false;
+
+ // Bee Alert Animation
+ if (alertBeeActive)
+ {
+
+ beeAlertRectangle.x -= 100*TIME_FACTOR;
+ beeAlertRectangle.width += 100*TIME_FACTOR;
+ beeAlertRectangle.height += 2.5*TIME_FACTOR;
+ beeAlertRectangle.y += 1.25*TIME_FACTOR;
+
+ if (beeAlertRectangle.height >= 100)
+ {
+ beeActive = true;
+ alertBeeActive = false;
+ }
+ }
+
+ // Bee Logic
+ if (beeActive == true && !isHitBee)
+ {
+ bee.x -= 3*speed;
+ beeMov = sin(2*PI/400*bee.x) * 5;
+ bee.y += beeMov*TIME_FACTOR;
+
+ if (CheckCollisionRecs(bee, player) && (state != FINALFORM) && (state != KICK))
+ {
+ velocity = 8;
+ jumpSpeed = 2;
+ play = false;
+ playerActive = false;
+ killer = 5;
+ }
+ else if (CheckCollisionRecs(bee, player) && (state == FINALFORM) && (state != KICK))
+ {
+ isHitBee = true;
+ beeVelocity = 8;
+ killHistory[killCounter] = 4;
+ killCounter++;
+
+ score += BEESCORE;
+ beeKillCounter++;
+ globalKillCounter++;
+
+ popupBee.position = (Vector2){ bee.x, bee.y };
+ popupBee.scale = 1.0f;
+ popupBee.alpha = 1.0f;
+ popupBee.score = BEESCORE;
+ popupBee.active = true;
+ }
+ }
+ else if (isHitBee)
+ {
+ if ((bee.y + bee.height) > GetScreenHeight())
+ {
+ beeActive = false;
+ isHitBee = false;
+ }
+
+ bee.x += 2*TIME_FACTOR;
+ beeVelocity -= 1*TIME_FACTOR*TIME_FACTOR;
+ bee.y -= beeVelocity*TIME_FACTOR;
+ }
+
+ if (bee.x + bee.width <= 0) beeActive = false;
+ }
+
+ // Power bar logic
+ powerBar.width = power;
+
+ if (power >= maxPower) power = maxPower;
+
+ if (currentLeaves >= LEAVESTOTRANSFORM && !coolDown)
+ {
+ flyColor = ORANGE;
+
+ if (leafGUIglow)
+ {
+ leafGUIglowFade += 0.01f*TIME_FACTOR;
+ if (leafGUIglowFade >= 1) leafGUIglow = false;
+ }
+ else
+ {
+ leafGUIglowFade -= 0.01f*TIME_FACTOR;
+ if (leafGUIglowFade <= 0) leafGUIglow = true;
+ }
+
+ leafGUIpulseFade -= 0.01f*TIME_FACTOR;
+ leafGUIpulseScale += 0.005F*TIME_FACTOR;
+
+ if (leafGUIpulseFade <= 0)
+ {
+ leafGUIpulseFade = 1;
+ leafGUIpulseScale = 1;
+ }
+
+#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
+ if ((IsGestureDetected(GESTURE_TAP) && CheckCollisionPointRec(GetTouchPosition(0), powerButton)) && (state != FINALFORM))
+ {
+ state = FINALFORM;
+ transforming = true;
+ //currentLeaves -= LEAVESTOTRANSFORM;
+ initLeaves = currentLeaves;
+ curFrameKoala = 0;
+ thisFrameKoala = 0;
+ superKoalaCounter++;
+ }
+#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
+
+ if ((IsKeyPressed(KEY_ENTER) || (CheckCollisionPointRec(GetMousePosition(), powerButton) && IsMouseButtonPressed(0))) && (state != FINALFORM))
+ {
+ state = FINALFORM;
+ transforming = true;
+ //currentLeaves -= LEAVESTOTRANSFORM;
+ initLeaves = currentLeaves;
+ curFrameKoala = 0;
+ thisFrameKoala = 0;
+ superKoalaCounter++;
+ }
+#endif
+ }
+#if defined(DEBUG)
+ if (currentLeaves < LEAVESTOTRANSFORM && (IsKeyPressed(KEY_ENTER)))
+ {
+ currentLeaves += LEAVESTOTRANSFORM;
+ }
+#endif
+
+ if (coolDown)
+ {
+ power += 20;
+
+ if (power >= maxPower) coolDown = false;
+ }
+
+ colorTimer += 1*TIME_FACTOR;
+
+ if (colorTimer > 10)
+ {
+ finalColor.r = GetRandomValue(0, 255);
+ finalColor.g = GetRandomValue(0, 255);
+ finalColor.b = GetRandomValue(0, 255);
+ colorTimer = 0;
+ }
+
+ // Ice logic
+ for (int i = 0; i < MAX_ICE; i++)
+ {
+ if (!iceActive[i]) ice[i].x = -100;
+
+ if (ice[i].x <= - ice[i].width) iceActive[i] = false;
+
+ if (CheckCollisionRecs(ice[i], player) && (state == GRABED)) onIce = true;
+ }
+
+ // Resin logic
+ for (int i = 0; i < MAX_RESIN; i++)
+ {
+ if (!resinActive[i]) resin[i].x = -100;
+
+ if (resin[i].x <= -resin[i].width) resinActive[i] = false;
+
+ if (CheckCollisionRecs(resin[i], player) && resinCount >= 30*TIME_FACTOR && state != FINALFORM)
+ {
+ if (!onResin)
+ {
+ PlaySound(fxHitResin);
+ resinCounter++;
+ }
+
+ onResin = true;
+ grabCounter = 10;
+
+ //gravity = 0;
+ state = GRABED;
+ }
+ }
+
+ // Wind logic
+ for (int i = 0; i < MAX_WIND; i++)
+ {
+ if (!windActive[i]) wind[i].x = -500;
+
+ else wind[i].x -= 9*speedMod*TIME_FACTOR;
+
+ if (wind[i].x <= - wind[i].width) windActive[i] = false;
+
+ if (CheckCollisionRecs(wind[i], player) && state != ONWIND && (windCounter >= 35) && state != FINALFORM)
+ {
+ state = ONWIND;
+ windCounter = 0;
+ velocity = JUMP;
+ grabCounter = 0;
+ jumpSpeed = 10;
+ rightAlpha = 1;
+ onIce = false;
+ onResin = false;
+ resinCountjump = 0;
+ resinCountdrag = 0;
+ tornadoCounter++;
+ }
+ }
+
+ // Fire logic
+ for (int i = 0; i < MAX_FIRE; i++)
+ {
+ //fire[i].x -= speed;
+
+ if (fireActive[i] == false) fire[i].x = -200;
+
+ if (fire[i].x <= (player.x + player.width) && !onFire[i])
+ {
+ onFire[i] = true;
+ }
+
+ if (onFire[i] && fire[i].y > -50 && !transforming)
+ {
+ fireCounter[i]++;
+ fire[i].y -= fireSpeed*TIME_FACTOR;
+ fireCounter[i] = 0;
+ //fire[i].height += fireSpeed;
+ }
+
+ if (fire[i].x <= -fire[i].width)
+ {
+ fireActive[i] = false;
+ onFire[i] = false;
+ }
+
+ if (CheckCollisionRecs(player, fire[i]))
+ {
+ if (state != FINALFORM)
+ {
+ velocity = 8;
+ jumpSpeed = 2;
+ play = false;
+ playerActive = false;
+ killer = 0;
+ }
+ }
+
+ for (int k = 0; k < MAX_ENEMIES; k++)
+ {
+ if (CheckCollisionRecs(fire[i], snake[k]) && !isHitSnake[k])
+ {
+ isHitSnake[k] = true;
+ enemyVel[k] = 8;
+ }
+ }
+ }
+
+ // Bamboo logic
+ for (int i = 0; i < MAX_BAMBOO; i++)
+ {
+ if (bambooActive[i])
+ {
+ bamboo[i].x -= speed;
+
+ if ((CheckCollisionRecs(player, bamboo[i])) && (state != FINALFORM))
+ {
+ if (grabCounter >= 10)
+ {
+ player.x = bamboo[i].x - 25;
+ state = GRABED;
+ }
+ }
+
+ if ((CheckCollisionRecs(player, bamboo[i])) && (state == FINALFORM))
+ {
+ if (power <= 1)
+ {
+ state = JUMPING;
+ velocity = JUMP;
+ jumpSpeed = 6;
+ scrollSpeed = 1.6f;
+ speedMod = 1.2f;
+ coolDown = true;
+ flyColor = GRAY;
+ speedFX.active = false;
+ }
+ }
+
+ for (int k = 0; k < MAX_ENEMIES; k++)
+ {
+ if ((CheckCollisionRecs(snake[k], bamboo[i])) && snakeActive[k] && !isHitSnake[k]) snake[k].x = bamboo[i].x - 15;
+ if ((CheckCollisionRecs(dingo[k], bamboo[i])) && dingoActive[k] && !isHitDingo[k]) dingo[k].x = bamboo[i].x - 15;
+ if ((CheckCollisionRecs(owl[k], bamboo[i])) && owlActive[k] && !isHitOwl[k]) owl[k].x = bamboo[i].x - 22;
+ if ((CheckCollisionRecs((Rectangle){branchPos[k].x, branchPos[k].y, gameplay_props_owl_branch.width, gameplay_props_owl_branch.height}, bamboo[i])) && branchActive[k]) branchPos[k].x = bamboo[i].x -24;
+ }
+
+ for (int j = 0; j < MAX_LEAVES; j++)
+ {
+ if ((CheckCollisionRecs(leaf[j], bamboo[i])) && leafActive[j])
+ {
+ if (leafSide[j])leaf[j].x = bamboo[i].x + 18;
+ else leaf[j].x = bamboo[i].x - 18;
+ }
+
+ //else leaf[j].x -= speed;
+ }
+
+ for (int z = 0; z < MAX_FIRE; z++)
+ {
+ if ((CheckCollisionRecs(fire[z], bamboo[i])) && fireActive[z]) fire[z].x = bamboo[i].x - 5;
+ //else fire[z].x -= speed;
+ }
+
+ for (int n = 0; n < MAX_ICE; n++)
+ {
+ if ((CheckCollisionRecs(ice[n], bamboo[i])) && iceActive[n]) ice[n].x = bamboo[i].x;
+ }
+
+ for (int m = 0; m < MAX_RESIN; m++)
+ {
+ if ((CheckCollisionRecs(resin[m], bamboo[i])) && resinActive[m]) resin[m].x = bamboo[i].x;
+ }
+
+ if (bamboo[i].x <= -(bamboo[i].width + 30))
+ {
+ bambooActive[i] = false;
+ }
+ }
+ }
+
+ // Enemy logic
+ for (int k = 0; k < MAX_ENEMIES; k++)
+ {
+ //if (snakeActive[k] && !isHitSnake[k])snake[k].x -= speed;
+
+ if (snake[k].x <= -snake[k].width) snakeActive[k] = false;
+ if (dingo[k].x <= -dingo[k].width) dingoActive[k] = false;
+ if (owl[k].x <= -owl[k].width) owlActive[k] = false;
+ if (branchPos[k].x <= -owl[k].width) branchActive[k] = false;
+
+ if (!snakeActive[k]) snake[k].x = -500;
+ if (!dingoActive[k]) dingo[k].x = -500;
+ if (!owlActive[k]) owl[k].x = -500;
+
+ if (CheckCollisionRecs(player, snake[k]) && (state != KICK) && !isHitSnake[k])
+ {
+ if (state != FINALFORM)
+ {
+ velocity = 8;
+ jumpSpeed = 2;
+ enemyVel[k] = 8;
+ play = false;
+ playerActive = false;
+ killer = 1;
+ }
+ else if (state == FINALFORM)
+ {
+ isHitSnake[k] = true;
+ enemyVel[k] = 8;
+ killHistory[killCounter] = 1;
+ killCounter++;
+
+ snakeKillCounter++;
+ globalKillCounter++;
+ score += SNAKESCORE;
+
+ PlaySound(fxDieSnake);
+
+ enemyHit[k].position = (Vector2){ snake[k].x, snake[k].y };
+ enemyHit[k].speed = (Vector2){ 0, 0 };
+ enemyHit[k].size = (float)GetRandomValue(0, 10)/30;
+ enemyHit[k].rotation = 0.0f;
+ //enemyHit[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
+ enemyHit[k].alpha = 1.0f;
+ enemyHit[k].active = true;
+
+ popupScore[k].position = (Vector2){ snake[k].x,snake[k].y };
+ popupScore[k].scale = 1.0f;
+ popupScore[k].alpha = 1.0f;
+ popupScore[k].score = SNAKESCORE;
+ popupScore[k].active = true;
+ }
+ }
+
+ if (CheckCollisionRecs(player, dingo[k]) && (state != KICK) && !isHitDingo[k])
+ {
+ if (state != FINALFORM)
+ {
+ velocity = 8;
+ jumpSpeed = 2;
+ play = false;
+ enemyVel[k] = 8;
+ playerActive = false;
+ killer = 2;
+ }
+ else if (state == FINALFORM)
+ {
+ isHitDingo[k] = true;
+ enemyVel[k] = 8;
+ killHistory[killCounter] = 2;
+ killCounter++;
+
+ score += DINGOSCORE;
+ dingoKillCounter++;
+ globalKillCounter++;
+
+ enemyHit[k].position = (Vector2){ dingo[k].x,dingo[k].y };
+ enemyHit[k].speed = (Vector2){ 0, 0 };
+ enemyHit[k].size = (float)GetRandomValue(5, 10)/30;
+ enemyHit[k].rotation = 0.0f;
+ //enemyHit[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
+ enemyHit[k].alpha = 1.0f;
+ enemyHit[k].active = true;
+
+ popupScore[k].position = (Vector2){ dingo[k].x,dingo[k].y };
+ popupScore[k].scale = 1.0f;
+ popupScore[k].alpha = 1.0f;
+ popupScore[k].score = DINGOSCORE;
+ popupScore[k].active = true;
+ }
+ }
+
+ if (CheckCollisionRecs(player, owl[k]) && (state != KICK) && !isHitOwl[k])
+ {
+ if (state != FINALFORM)
+ {
+ velocity = 8;
+ enemyVel[k] = 8;
+ jumpSpeed = 2;
+ play = false;
+ playerActive = false;
+ killer = 3;
+ }
+ else if (state == FINALFORM)
+ {
+ isHitOwl[k] = true;
+ enemyVel[k] = 8;
+ killHistory[killCounter] = 3;
+ killCounter++;
+
+ score += OWLSCORE;
+ owlKillCounter++;
+ globalKillCounter++;
+
+ enemyHit[k].position = (Vector2){ owl[k].x, owl[k].y };
+ enemyHit[k].speed = (Vector2){ owl[k].x, owl[k].y };
+ enemyHit[k].size = (float)GetRandomValue(5, 10)/30;
+ enemyHit[k].rotation = 0.0f;
+ //enemyHit[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
+ enemyHit[k].alpha = 1.0f;
+ enemyHit[k].active = true;
+
+ popupScore[k].position = (Vector2){ owl[k].x,owl[k].y };
+ popupScore[k].scale = 1.0f;
+ popupScore[k].alpha = 1.0f;
+ popupScore[k].score = OWLSCORE;
+ popupScore[k].active = true;
+ }
+ }
+
+ if (isHitSnake[k])
+ {
+ if ((snake[k].y + snake[k].height) > GetScreenHeight())
+ {
+ snakeActive[k] = false;
+ isHitSnake[k] = false;
+ }
+
+ snake[k].x += 2*TIME_FACTOR;
+ enemyVel[k] -= 1*TIME_FACTOR*TIME_FACTOR;
+ snake[k].y -= enemyVel[k]*TIME_FACTOR;
+ }
+
+ if (isHitDingo[k])
+ {
+ if ((dingo[k].y) > GetScreenHeight())
+ {
+ dingoActive[k] = false;
+ isHitDingo[k] = false;
+ }
+
+ dingo[k].x += 2*TIME_FACTOR;
+ enemyVel[k] -= 1*TIME_FACTOR*TIME_FACTOR;
+ dingo[k].y -= enemyVel[k]*TIME_FACTOR;
+ }
+
+ if (isHitOwl[k])
+ {
+ if ((owl[k].y) > GetScreenHeight())
+ {
+ owlActive[k] = false;
+ isHitOwl[k] = false;
+ }
+
+ owl[k].x += 2*TIME_FACTOR;
+ enemyVel[k] -= 1*TIME_FACTOR*TIME_FACTOR;
+ owl[k].y -= enemyVel[k];
+ }
+ }
+
+ // Leaves logic
+ for (int j = 0; j < MAX_LEAVES; j++)
+ {
+ //leaf[j].x -= speed;
+
+ leafParticles[j].position = (Vector2){ leaf[j].x, leaf[j].y};
+
+
+ if (leaf[j].x <= -leaf[j].width) leafActive[j] = false;
+
+ if (CheckCollisionRecs(player, leaf[j]) && leafActive[j])
+ {
+ //power += 20;
+ //printf("coin %c", coinType[j]);
+
+ // DONE: Review
+ popupLeaves[j].position = (Vector2){ leaf[j].x, leaf[j].y };
+ popupLeaves[j].scale = 1.0f;
+ popupLeaves[j].alpha = 1.0f;
+ popupLeaves[j].active = true;
+
+ PlaySound(fxEatLeaves);
+
+ if(leafType[j] == 0)
+ {
+ currentLeaves++;
+ popupLeaves[j].score = 1;
+ }
+
+ else if(leafType[j] == 1)
+ {
+ currentLeaves += 2;
+ popupLeaves[j].score = 2;
+ }
+
+ else if(leafType[j] == 2)
+ {
+ currentLeaves += 3;
+ popupLeaves[j].score = 3;
+ }
+
+ else if(leafType[j] == 3)
+ {
+ currentLeaves += 4;
+ popupLeaves[j].score = 4;
+ }
+
+ leafActive[j] = false;
+ leafParticles[j].active = true;
+
+ for (int h = 0; h < 32; h++)
+ {
+ leafParticles[j].particles[h].active = true;
+ leafParticles[j].particles[h].position = (Vector2){ leafParticles[j].position.x, leafParticles[j].position.y};
+ leafParticles[j].particles[h].speed = (Vector2){ (float)GetRandomValue(-400, 400)/100, (float)GetRandomValue(-400, 400)/100 };
+ leafParticles[j].particles[h].size = (float)GetRandomValue(4, 8)/10;
+ leafParticles[j].particles[h].rotation = GetRandomValue(-180, 180);
+ //enemyHit[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
+ leafParticles[j].particles[h].alpha = 1.0f;
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------------------
+ // Particles Logic
+ //----------------------------------------------------------------------------------
+
+ // Leaf particles logic
+ for (int i = 0; i < MAX_LEAVES; i++)
+ {
+
+ if (leafParticles[i].active == true)
+ {
+
+ for (int j = 0; j < 32; j++)
+ {
+ //enemyHit[i].speed.y -= 1;
+
+ leafParticles[i].particles[j].position.x += leafParticles[i].particles[j].speed.x*TIME_FACTOR;
+ leafParticles[i].particles[j].position.y += leafParticles[i].particles[j].speed.y;
+
+ //if (((enemyHitPosition.x + enemyHit[i].position.x + enemyHit[i].size) >= screenWidth) || ((enemyHitPosition.x + enemyHit[i].position.x - enemyHit[i].size) <= 0)) enemyHit[i].speed.x *= -1;
+ //if (((enemyHitPosition.y + enemyHit[i].position.y + enemyHit[i].size) >= screenHeight) || ((enemyHitPosition.y + enemyHit[i].position.y - enemyHit[i].size) <= 0)) enemyHit[i].speed.y *= -1;
+
+ leafParticles[i].particles[j].rotation += 6*TIME_FACTOR;
+ leafParticles[i].particles[j].alpha -= 0.03f*TIME_FACTOR;
+ leafParticles[i].particles[j].size -= 0.004*TIME_FACTOR;
+
+ if (leafParticles[i].particles[j].size <= 0) leafParticles[i].particles[j].size = 0.0f;
+
+ if (leafParticles[i].particles[j].alpha <= 0)
+ {
+ leafParticles[i].particles[j].alpha = 0.0f;
+ leafParticles[i].particles[j].active = false;
+ leafParticles[i].active = false;
+ }
+ }
+ }
+
+ if (popupLeaves[i].active)
+ {
+ //mouseTail[i].position.y += gravity;
+ popupLeaves[i].alpha -= 0.02f;
+ popupLeaves[i].scale += 0.1f;
+ popupLeaves[i].position.y -= 3.0f;
+ popupLeaves[i].position.x -= speed;
+
+ if (popupLeaves[i].alpha <= 0.0f) popupLeaves[i].active = false;
+ }
+ }
+
+ // Enemy Particles
+ for (int i = 0; i < MAX_ENEMIES; i++)
+ {
+ if (enemyHit[i].active)
+ {
+ //mouseTail[i].position.y += gravity;
+ enemyHit[i].alpha -= 0.1f*TIME_FACTOR;
+ enemyHit[i].size += 0.1f*TIME_FACTOR;
+
+ if (enemyHit[i].alpha <= 0.0f) enemyHit[i].active = false;
+ }
+
+ if (popupScore[i].active)
+ {
+ //mouseTail[i].position.y += gravity;
+ popupScore[i].alpha -= 0.02f;
+ popupScore[i].scale += 0.2f;
+ popupScore[i].position.y -= 4.0f;
+ popupScore[i].position.x -= speed;
+
+ if (popupScore[i].alpha <= 0.0f) popupScore[i].active = false;
+ }
+ }
+
+ if (popupBee.active)
+ {
+ //mouseTail[i].position.y += gravity;
+ popupBee.alpha -= 0.02f;
+ popupBee.scale += 0.2f;
+ popupBee.position.y -= 4.0f;
+ popupBee.position.x -= speed;
+
+ if (popupBee.alpha <= 0.0f) popupBee.active = false;
+ }
+
+ if (popupEagle.active)
+ {
+ //mouseTail[i].position.y += gravity;
+ popupEagle.alpha -= 0.02f;
+ popupEagle.scale += 0.2f;
+ popupEagle.position.y -= 4.0f;
+ popupEagle.position.x -= speed;
+
+ if (popupEagle.alpha <= 0.0f) popupEagle.active = false;
+ }
+
+ if (state != FINALFORM)
+ {
+ // Snow Particle
+ if (snowParticle.active)
+ {
+ snowParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (!snowParticle.particles[i].active && (snowParticle.spawnTime >= snowParticle.maxTime))
+ {
+ snowParticle.particles[i].active = true;
+ snowParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ snowParticle.spawnTime = 0;
+ snowParticle.maxTime = GetRandomValue(5, 20);
+ }
+ }
+ }
+
+ if (backSnowParticle.active)
+ {
+ snowParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (!backSnowParticle.particles[i].active && (backSnowParticle.spawnTime >= backSnowParticle.maxTime))
+ {
+ backSnowParticle.particles[i].active = true;
+ backSnowParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ backSnowParticle.spawnTime = 0;
+ backSnowParticle.maxTime = GetRandomValue(3, 10);
+ }
+ }
+ }
+
+ // Autumn leaves particles
+ if (planetreeParticle.active)
+ {
+ planetreeParticle.spawnTime += 1*TIME_FACTOR;
+ backPlanetreeParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (!planetreeParticle.particles[i].active && (planetreeParticle.spawnTime >= planetreeParticle.maxTime))
+ {
+ planetreeParticle.particles[i].active = true;
+ planetreeParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ planetreeParticle.spawnTime = 0;
+ planetreeParticle.maxTime = GetRandomValue(5, 20);
+ }
+
+ if (!backPlanetreeParticle.particles[i].active && (backPlanetreeParticle.spawnTime >= backPlanetreeParticle.maxTime))
+ {
+ backPlanetreeParticle.particles[i].active = true;
+ backPlanetreeParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ backPlanetreeParticle.spawnTime = 0;
+ backPlanetreeParticle.maxTime = GetRandomValue(3, 10);
+ }
+ }
+ }
+
+ // Dandelion particle
+ if (dandelionParticle.active)
+ {
+ dandelionParticle.spawnTime += 1*TIME_FACTOR;
+ dandelionBackParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (!dandelionParticle.particles[i].active && (dandelionParticle.spawnTime >= dandelionParticle.maxTime))
+ {
+ dandelionParticle.particles[i].active = true;
+ dandelionParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ dandelionParticle.spawnTime = 0;
+ dandelionParticle.maxTime = GetRandomValue(5, 20);
+ }
+
+ if (!dandelionBackParticle.particles[i].active && (dandelionBackParticle.spawnTime >= dandelionBackParticle.maxTime))
+ {
+ dandelionBackParticle.particles[i].active = true;
+ dandelionBackParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ dandelionBackParticle.spawnTime = 0;
+ dandelionBackParticle.maxTime = GetRandomValue(3, 10);
+ }
+ }
+ }
+
+ // Flower Particle
+ if (flowerParticle.active)
+ {
+
+ flowerParticle.spawnTime += 1*TIME_FACTOR;
+ backFlowerParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (!flowerParticle.particles[i].active && (flowerParticle.spawnTime >= flowerParticle.maxTime))
+ {
+ flowerParticle.particles[i].active = true;
+ flowerParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ flowerParticle.spawnTime = 0;
+ flowerParticle.maxTime = GetRandomValue(5, 20);
+ }
+
+ if (!backFlowerParticle.particles[i].active && (backFlowerParticle.spawnTime >= backFlowerParticle.maxTime))
+ {
+ backFlowerParticle.particles[i].active = true;
+ backFlowerParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ backFlowerParticle.spawnTime = 0;
+ backFlowerParticle.maxTime = GetRandomValue(3, 10);
+ }
+ }
+ }
+
+ // Rain Particle
+ if (rainParticle.active)
+ {
+ rainParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (!rainParticle.particles[i].active && (rainParticle.spawnTime >= rainParticle.maxTime))
+ {
+ rainParticle.particles[i].active = true;
+ rainParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ rainParticle.spawnTime = 0;
+ rainParticle.maxTime = GetRandomValue(1, 8);
+ }
+ }
+ }
+
+ // BackRain Particles
+ if (backRainParticle.active)
+ {
+ backRainParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (!backRainParticle.particles[i].active && (backRainParticle.spawnTime >= backRainParticle.maxTime))
+ {
+ backRainParticle.particles[i].active = true;
+ backRainParticle.particles[i].position = (Vector2){ GetRandomValue(0, GetScreenWidth() + 200), -10 };
+ backRainParticle.spawnTime = 0;
+ backRainParticle.maxTime = GetRandomValue(1, 8);
+ }
+ }
+ }
+
+ // Storm Particles
+ if (rainStormParticle.active)
+ {
+ rainStormParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES_STORM; i++)
+ {
+ if (!rainStormParticle.particles[i].active && (rainStormParticle.spawnTime >= rainStormParticle.maxTime))
+ {
+ for (int j = 0; j < 16; j++)
+ {
+ rainStormParticle.particles[i+j].active = true;
+ rainStormParticle.particles[i+j].position = (Vector2){ GetRandomValue(100, GetScreenWidth() + 1000), GetRandomValue(-10,-20) };
+ }
+
+ rainStormParticle.spawnTime = 0;
+ rainStormParticle.maxTime = 4;
+ }
+ }
+ }
+
+ // Snow Storm Particles
+ if (snowStormParticle.active)
+ {
+ snowStormParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES_STORM; i++)
+ {
+ if (!snowStormParticle.particles[i].active && (snowStormParticle.spawnTime >= snowStormParticle.maxTime))
+ {
+ snowStormParticle.particles[i].active = true;
+ snowStormParticle.particles[i].position = (Vector2){ GetRandomValue(100, GetScreenWidth() + 800), -10 };
+ snowStormParticle.spawnTime = 0;
+ snowStormParticle.maxTime = GetRandomValue(1, 2);
+ }
+ }
+ }
+
+ }
+
+ // Speed Particles
+ if (speedFX.active)
+ {
+ speedFX.spawnTime++;
+
+ for (int i = 0; i < MAX_PARTICLES_SPEED; i++)
+ {
+ if (!speedFX.particle[i].active && (speedFX.spawnTime >= speedFX.maxTime))
+ {
+ speedFX.particle[i].active = true;
+ speedFX.particle[i].alpha = 0.7f;
+ speedFX.particle[i].size = (Vector2){ GetScreenWidth(), GetRandomValue(5, 30) };
+ speedFX.particle[i].position = (Vector2){ GetScreenWidth(), GetRandomValue(0, GetScreenHeight() - 10) };
+ speedFX.spawnTime = 0;
+ speedFX.maxTime = GetRandomValue(1, 10);
+ //i = MAX_PARTICLES;
+ }
+ }
+ }
+
+ for (int i = 0; i < MAX_PARTICLES_SPEED; i++)
+ {
+ if (speedFX.particle[i].active)
+ {
+ speedFX.particle[i].position.x -= 40;
+ speedFX.particle[i].alpha -= 0.015f;
+ speedFX.particle[i].size.y -= 0.1f;
+
+ if (speedFX.particle[i].size.y <= 0) speedFX.particle[i].active = false;
+ }
+ }
+
+ // Ray Particles
+ if (rayParticles.active)
+ {
+ rayParticles.spawnTime += 1*TIME_FACTOR;
+ backRayParticles.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_PARTICLES_RAY; i++)
+ {
+ if (!rayParticles.particles[i].active && (rayParticles.spawnTime >= rayParticles.maxTime))
+ {
+ //printf("PARTICLEEES");
+ rayParticles.particles[i].active = true;
+ rayParticles.particles[i].alpha = 0.0f;
+ rayParticles.particles[i].size = (float)(GetRandomValue(10, 20)/10);
+ rayParticles.particles[i].position = (Vector2){ GetRandomValue(300, GetScreenWidth() + 200), 0 };
+ rayParticles.particles[i].rotation = -35;
+ rayParticles.spawnTime = 0;
+ rayParticles.particles[i].delayCounter = 0;
+ rayParticles.maxTime = GetRandomValue(20, 50);
+ }
+
+ if (!backRayParticles.particles[i].active && (backRayParticles.spawnTime >= backRayParticles.maxTime))
+ {
+ backRayParticles.particles[i].active = true;
+ backRayParticles.particles[i].alpha = 0.0f;
+ backRayParticles.particles[i].size = (float)(GetRandomValue(5, 15)/10);
+ backRayParticles.particles[i].position = (Vector2){ GetRandomValue(300, GetScreenWidth() + 200), 0 };
+ backRayParticles.particles[i].rotation = -35;
+ backRayParticles.spawnTime = 0;
+ backRayParticles.particles[i].delayCounter = 0;
+ backRayParticles.maxTime = GetRandomValue(20, 50);
+ }
+ }
+ }
+
+ // Particles Logic
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (snowParticle.particles[i].active)
+ {
+ snowParticle.particles[i].position.y += 2*speedMod*TIME_FACTOR;
+ snowParticle.particles[i].position.x -= 4*speedMod*TIME_FACTOR;
+ snowParticle.particles[i].rotation += 0.5*TIME_FACTOR;
+
+ if (snowParticle.particles[i].position.y >= GetScreenHeight()) snowParticle.particles[i].active = false;
+ }
+
+ if (backSnowParticle.particles[i].active)
+ {
+ backSnowParticle.particles[i].position.y += (int)1.5f*speedMod*TIME_FACTOR;
+ backSnowParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
+ backSnowParticle.particles[i].rotation += 0.5*TIME_FACTOR;
+
+ if (backSnowParticle.particles[i].position.y >= GetScreenHeight()) backSnowParticle.particles[i].active = false;
+ }
+
+ if (planetreeParticle.particles[i].active)
+ {
+ planetreeParticle.particles[i].position.y += 4*speedMod*TIME_FACTOR;
+ planetreeParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
+ planetreeParticle.particles[i].rotation += 0.5*TIME_FACTOR;
+
+ if (planetreeParticle.particles[i].position.y >= GetScreenHeight()) planetreeParticle.particles[i].active = false;
+ }
+
+ if (backPlanetreeParticle.particles[i].active)
+ {
+ backPlanetreeParticle.particles[i].position.y += 3*speedMod*TIME_FACTOR;
+ backPlanetreeParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
+ backPlanetreeParticle.particles[i].rotation += 0.5*TIME_FACTOR;
+
+ if (backPlanetreeParticle.particles[i].position.y >= GetScreenHeight()) backPlanetreeParticle.particles[i].active = false;
+ }
+
+ if (dandelionParticle.particles[i].active)
+ {
+ dandelionParticle.particles[i].position.y += 3*speedMod*TIME_FACTOR;
+ dandelionParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
+ dandelionParticle.particles[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30);
+
+ if (dandelionParticle.particles[i].position.y >= GetScreenHeight()) dandelionParticle.particles[i].active = false;
+ }
+
+ if (dandelionBackParticle.particles[i].active)
+ {
+ dandelionBackParticle.particles[i].position.y += (int)1.5f*speedMod*TIME_FACTOR;
+ dandelionBackParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
+ dandelionBackParticle.particles[i].rotation = 30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30;
+
+ if (dandelionBackParticle.particles[i].position.y >= GetScreenHeight()) dandelionBackParticle.particles[i].active = false;
+ }
+
+ if (flowerParticle.particles[i].active)
+ {
+ flowerParticle.particles[i].position.y += 2.5f*speedMod*TIME_FACTOR;
+ flowerParticle.particles[i].position.x -= 4*speedMod*TIME_FACTOR;
+ flowerParticle.particles[i].rotation += 0.5*TIME_FACTOR;
+
+ if (flowerParticle.particles[i].position.y >= GetScreenHeight()) flowerParticle.particles[i].active = false;
+ }
+
+ if (backFlowerParticle.particles[i].active)
+ {
+ backFlowerParticle.particles[i].position.y += 2.5f*speedMod*TIME_FACTOR;
+ backFlowerParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
+ backFlowerParticle.particles[i].rotation += 0.5*TIME_FACTOR;
+
+ if (backFlowerParticle.particles[i].position.y >= GetScreenHeight()) backFlowerParticle.particles[i].active = false;
+ }
+
+ if (rainParticle.particles[i].active)
+ {
+ rainParticle.particles[i].position.y += 8*speedMod*TIME_FACTOR;
+ rainParticle.particles[i].position.x -= 10*speedMod*TIME_FACTOR;
+ //rainParticle.particles[i].rotation += 0.5;
+
+ if (rainParticle.particles[i].position.y >= GetScreenHeight()) rainParticle.particles[i].active = false;
+ }
+
+ if (backRainParticle.particles[i].active)
+ {
+ backRainParticle.particles[i].position.y += 6*speedMod*TIME_FACTOR;
+ backRainParticle.particles[i].position.x -= 6*speedMod*TIME_FACTOR;
+ //rainParticle.particles[i].rotation += 0.5;
+
+ if (backRainParticle.particles[i].position.y >= GetScreenHeight()) backRainParticle.particles[i].active = false;
+ }
+ }
+
+ for (int i = 0; i < MAX_PARTICLES_STORM; i++)
+ {
+ if (rainStormParticle.particles[i].active)
+ {
+ rainStormParticle.particles[i].position.y += 12*speedMod*TIME_FACTOR;
+ rainStormParticle.particles[i].position.x -= 15*speedMod*TIME_FACTOR;
+ //rainParticle.particles[i].rotation += 0.5;
+
+ if (rainStormParticle.particles[i].position.y >= GetScreenHeight()) rainStormParticle.particles[i].active = false;
+ if (rainStormParticle.active == false)rainStormParticle.particles[i].alpha -= 0.01;
+ }
+ }
+
+ for (int i = 0; i < MAX_PARTICLES_STORM; i++)
+ {
+ if (snowStormParticle.particles[i].active)
+ {
+ snowStormParticle.particles[i].position.y += 12*speedMod*TIME_FACTOR;
+ snowStormParticle.particles[i].position.x -= 15*speedMod*TIME_FACTOR;
+ snowStormParticle.particles[i].rotation += 0.5*TIME_FACTOR;
+ if (snowStormParticle.particles[i].position.y >= GetScreenHeight()) snowStormParticle.particles[i].active = false;
+ }
+ }
+
+ for (int i = 0; i < MAX_PARTICLES_RAY; i++)
+ {
+ if (rayParticles.particles[i].active)
+ {
+ rayParticles.particles[i].position.x -= 0.5*speedMod*TIME_FACTOR;
+ //printf("RAY X: %i", rayParticles.particles[i].position.x);
+
+ if (rayParticles.particles[i].fading)
+ {
+ rayParticles.particles[i].alpha -= 0.01f;
+
+ if (rayParticles.particles[i].alpha <= 0)
+ {
+ rayParticles.particles[i].alpha = 0;
+ rayParticles.particles[i].delayCounter += 1;
+ if (rayParticles.particles[i].delayCounter >= 30)
+ {
+ rayParticles.particles[i].active = false;
+ rayParticles.particles[i].delayCounter = 0;
+ rayParticles.particles[i].fading = false;
+ }
+ }
+ }
+ else
+ {
+ rayParticles.particles[i].alpha += 0.01f;
+
+ if (rayParticles.particles[i].alpha >= 0.5f)
+ {
+ rayParticles.particles[i].alpha = 0.5f;
+ rayParticles.particles[i].delayCounter += 1*TIME_FACTOR;
+ if (rayParticles.particles[i].delayCounter >= 30)
+ {
+ rayParticles.particles[i].delayCounter = 0;
+ rayParticles.particles[i].fading = true;
+ }
+ }
+ }
+ }
+
+ if (backRayParticles.particles[i].active)
+ {
+ backRayParticles.particles[i].position.x -= 0.5*speedMod*TIME_FACTOR;
+
+ if (backRayParticles.particles[i].fading)
+ {
+ backRayParticles.particles[i].alpha -= 0.01f;
+
+ if (backRayParticles.particles[i].alpha <= 0)
+ {
+ backRayParticles.particles[i].alpha = 0;
+ backRayParticles.particles[i].delayCounter += 1;
+
+ if (backRayParticles.particles[i].delayCounter >= 30)
+ {
+ backRayParticles.particles[i].active = false;
+ backRayParticles.particles[i].delayCounter = 0;
+ backRayParticles.particles[i].fading = false;
+ }
+ }
+ }
+ else
+ {
+ backRayParticles.particles[i].alpha += 0.01f;
+
+ if (backRayParticles.particles[i].alpha >= 0.5f)
+ {
+ backRayParticles.particles[i].alpha = 0.5f;
+ backRayParticles.particles[i].delayCounter +=1;
+
+ if (backRayParticles.particles[i].delayCounter >= 30)
+ {
+ backRayParticles.particles[i].delayCounter = 0;
+ backRayParticles.particles[i].fading = true;
+ }
+ }
+ }
+ }
+ }
+
+ // Player States
+ switch (state)
+ {
+ case GRABED:
+ {
+ onWind = false;
+ windCounter += 1*TIME_FACTOR;
+ resinCount += 1*TIME_FACTOR;
+ //speedMod = 1;
+
+ thisFrameKoala += 1*TIME_FACTOR;
+
+ if (thisFrameKoala >= 24)
+ {
+ curFrameKoala += 1;
+ thisFrameKoala = 0;
+ }
+
+ if (curFrameKoala > 2) curFrameKoala = 0;
+
+ koalaAnimationIddle.x = gameplay_koala_idle.x + koalaAnimationIddle.width*curFrameKoala;
+
+ if (!onResin)
+ {
+#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
+ if (((IsGestureDetected(GESTURE_TAP) || (GetGestureDetected() == GESTURE_DOUBLETAP)) && CheckCollisionPointRec(GetTouchPosition(0), rightButton)))
+ {
+ state = JUMPING;
+ velocity = JUMP;
+ grabCounter = 0;
+ jumpSpeed = 6;
+ rightAlpha = 1;
+ onIce = false;
+ onResin = false;
+ thisFrameKoala = 0;
+ PlaySound(fxJump);
+
+ jumpCounter++;
+ }
+
+ if (((IsGestureDetected(GESTURE_TAP) || (GetGestureDetected() == GESTURE_DOUBLETAP)) && CheckCollisionPointRec(GetTouchPosition(0), leftButton)))
+ {
+ if(!onIce)gravity = KICKSPEED;
+ else gravity = ICEGRAVITY;
+ PlaySound(fxDash);
+
+ state = KICK;
+ grabCounter = 0;
+ leftAlpha = 1;
+ onResin = false;
+ dashCounter++;
+ //thisFrameKoala = 0;
+ }
+ else
+ {
+ if(!onIce)gravity = GRAVITY;
+ else gravity = ICEGRAVITY;
+ //thisFrameKoala = 0;
+ }
+#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
+
+ if (IsKeyPressed(KEY_SPACE) || (CheckCollisionPointRec(GetMousePosition(), rightButton) && IsMouseButtonPressed(0)))
+ {
+ state = JUMPING;
+ velocity = JUMP;
+ grabCounter = 0;
+ jumpSpeed = 6;
+ rightAlpha = 1;
+ onIce = false;
+ onResin = false;
+ thisFrameKoala = 0;
+ PlaySound(fxJump);
+ jumpCounter++;
+ }
+
+ if (IsKeyPressed(KEY_DOWN) || (CheckCollisionPointRec(GetMousePosition(), leftButton) && IsMouseButtonPressed(0)))
+ {
+ if(!onIce)gravity = KICKSPEED;
+ else gravity = ICEGRAVITY;
+ PlaySound(fxDash);
+
+ state = KICK;
+ grabCounter = 0;
+ leftAlpha = 1;
+ onResin = false;
+ dashCounter++;
+ //thisFrameKoala = 0;
+ }
+ else
+ {
+ if(!onIce)gravity = GRAVITY;
+ else gravity = ICEGRAVITY;
+ //thisFrameKoala = 0;
+ }
+#endif
+ }
+ else
+ {
+#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
+ if (((IsGestureDetected(GESTURE_TAP) || (GetGestureDetected() == GESTURE_DOUBLETAP)) && CheckCollisionPointRec(GetTouchPosition(0), rightButton)))
+ {
+ resinCountjump++;
+
+ if (resinCountjump >= 2)
+ {
+ //thisFrameKoala = 0;
+
+ state = JUMPING;
+ velocity = JUMP;
+ grabCounter = 0;
+ jumpSpeed = 6;
+ rightAlpha = 1;
+ onIce = false;
+ onResin = false;
+ resinCountjump = 0;
+ resinCountdrag = 0;
+ resinCount = 0;
+ jumpCounter++;
+ }
+ }
+
+ if (((IsGestureDetected(GESTURE_TAP) || (GetGestureDetected() == GESTURE_DOUBLETAP)) && CheckCollisionPointRec(GetTouchPosition(0), leftButton)))
+ {
+ resinCountdrag ++;
+
+ if (resinCountdrag >= 2)
+ {
+ //thisFrameKoala = 0;
+ gravity = KICKSPEED;
+ state = KICK;
+ grabCounter = 0;
+ leftAlpha = 1;
+ onResin = false;
+ resinCountjump = 0;
+ resinCountdrag = 0;
+ resinCount = 0;
+ dashCounter++;
+ }
+ }
+ else
+ {
+ gravity = 0;
+ }
+#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
+ if (IsKeyPressed(KEY_SPACE) || (CheckCollisionPointRec(GetMousePosition(), rightButton) && IsMouseButtonPressed(0)))
+ {
+ resinCountjump++;
+
+ if (resinCountjump >= 2)
+ {
+ //thisFrameKoala = 0;
+
+ state = JUMPING;
+ velocity = JUMP;
+ grabCounter = 0;
+ jumpSpeed = 6;
+ rightAlpha = 1;
+ onIce = false;
+ onResin = false;
+ resinCountjump = 0;
+ resinCountdrag = 0;
+ resinCount = 0;
+ jumpCounter++;
+ }
+ }
+
+ if (IsKeyPressed(KEY_DOWN) || (CheckCollisionPointRec(GetMousePosition(), leftButton) && IsMouseButtonPressed(0)))
+ {
+ resinCountdrag ++;
+
+ if (resinCountdrag >= 2)
+ {
+ //thisFrameKoala = 0;
+ gravity = KICKSPEED;
+ state = KICK;
+ grabCounter = 0;
+ leftAlpha = 1;
+ onResin = false;
+ resinCountjump = 0;
+ resinCountdrag = 0;
+ resinCount = 0;
+ dashCounter++;
+ }
+ }
+ else
+ {
+ gravity = 0;
+ }
+#endif
+ }
+ } break;
+ case JUMPING:
+ {
+ player.x += jumpSpeed*TIME_FACTOR;
+ velocity -= 1*TIME_FACTOR*TIME_FACTOR;
+ player.y -= velocity;
+ framesCounter += 1*TIME_FACTOR;
+ grabCounter+= 1*TIME_FACTOR;
+
+ } break;
+ case KICK:
+ {
+ gravity += 1*TIME_FACTOR*TIME_FACTOR;
+ player.y += gravity;
+ player.x -= speed;
+ grabCounter += 1*TIME_FACTOR;
+
+ // DONE: Review, before checking collision with ALL enemies, check if they are active!
+ for (int i = 0; i < MAX_ENEMIES; i++)
+ {
+ if (CheckCollisionRecs(player, snake[i]) && !isHitSnake[i] && snakeActive[i])
+ {
+ state = JUMPING;
+ velocity = JUMP;
+ enemyVel[i] = 8;
+ grabCounter = 3;
+ gravity = KICKSPEED;
+ isHitSnake[i] = true;
+ jumpSpeed = -3;
+ score += SNAKESCORE;
+ killHistory[killCounter] = 1;
+ killCounter++;
+ PlaySound(fxDieSnake);
+ snakeKillCounter++;
+ globalKillCounter++;
+
+ enemyHit[i].position = (Vector2){ snake[i].x, snake[i].y };
+ enemyHit[i].speed = (Vector2){ snake[i].x, snake[i].y };
+ enemyHit[i].size = (float)GetRandomValue(5, 10)/30;
+ enemyHit[i].rotation = 0.0f;
+ //enemyHit[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
+ enemyHit[i].alpha = 1.0f;
+ enemyHit[i].active = true;
+
+ popupScore[i].position = (Vector2){ snake[i].x,snake[i].y };
+ popupScore[i].scale = 1.0f;
+ popupScore[i].alpha = 1.0f;
+ popupScore[i].score = SNAKESCORE;
+ popupScore[i].active = true;
+ }
+
+ if (CheckCollisionRecs(player, dingo[i]) && !isHitDingo[i] && dingoActive[i])
+ {
+ state = JUMPING;
+ velocity = JUMP;
+ enemyVel[i] = 8*TIME_FACTOR;
+ grabCounter = 3*TIME_FACTOR;
+ gravity = KICKSPEED;
+ isHitDingo[i] = true;
+ jumpSpeed = -3;
+ score += DINGOSCORE;
+ killHistory[killCounter] = 2;
+ killCounter++;
+ PlaySound(fxDieDingo);
+ dingoKillCounter++;
+ globalKillCounter++;
+
+ enemyHit[i].position = (Vector2){ dingo[i].x, dingo[i].y };
+ enemyHit[i].speed = (Vector2){ dingo[i].x, dingo[i].y };
+ enemyHit[i].size = (float)GetRandomValue(5, 10)/30;
+ enemyHit[i].rotation = 0.0f;
+ //enemyHit[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
+ enemyHit[i].alpha = 1.0f;
+ enemyHit[i].active = true;
+
+ popupScore[i].position = (Vector2){ dingo[i].x,dingo[i].y };
+ popupScore[i].scale = 1.0f;
+ popupScore[i].alpha = 1.0f;
+ popupScore[i].score = DINGOSCORE;
+ popupScore[i].active = true;
+ }
+
+ if (CheckCollisionRecs(player, owl[i]) && !isHitOwl[i] && owlActive[i])
+ {
+ state = JUMPING;
+ velocity = JUMP;
+ enemyVel[i] = 8;
+ grabCounter = 3;
+ gravity = KICKSPEED;
+ isHitOwl[i] = true;
+ jumpSpeed = -3;
+ score += OWLSCORE;
+ killHistory[killCounter] = 3;
+ killCounter++;
+ PlaySound(fxDieOwl);
+ owlKillCounter++;
+ globalKillCounter++;
+
+ enemyHit[i].position = (Vector2){ owl[i].x, owl[i].y };
+ enemyHit[i].speed = (Vector2){ owl[i].x, owl[i].y };
+ enemyHit[i].size = (float)GetRandomValue(5, 10)/30;
+ enemyHit[i].rotation = 0.0f;
+ //enemyHit[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
+ enemyHit[i].alpha = 1.0f;
+ enemyHit[i].active = true;
+
+ popupScore[i].position = (Vector2){ owl[i].x,owl[i].y };
+ popupScore[i].scale = 1.0f;
+ popupScore[i].alpha = 1.0f;
+ popupScore[i].score = OWLSCORE;
+ popupScore[i].active = true;
+ }
+ }
+
+ if (CheckCollisionRecs(player, bee) && !isHitBee && beeActive)
+ {
+ state = JUMPING;
+ velocity = JUMP;
+ beeVelocity = 8;
+ grabCounter = 3;
+ gravity = KICKSPEED;
+ isHitBee = true;
+ jumpSpeed = -3;
+ score += BEESCORE;
+ killHistory[killCounter] = 4;
+ killCounter++;
+ beeKillCounter++;
+ globalKillCounter++;
+
+ popupBee.position = (Vector2){ bee.x, bee.y };
+ popupBee.scale = 1.0f;
+ popupBee.alpha = 1.0f;
+ popupBee.score = BEESCORE;
+ popupBee.active = true;
+ }
+
+ if (CheckCollisionRecs(player, eagle) && !isHitEagle && eagleActive)
+ {
+ state = JUMPING;
+ velocity = JUMP;
+ beeVelocity = 8;
+ grabCounter = 3;
+ gravity = KICKSPEED;
+ isHitEagle = true;
+ jumpSpeed = -3;
+ score += EAGLESCORE;
+ killHistory[killCounter] = 5;
+ killCounter++;
+ eagleKillCounter++;
+ globalKillCounter++;
+
+ popupEagle.position = (Vector2){ eagle.x, eagle.y };
+ popupEagle.scale = 1.0f;
+ popupEagle.alpha = 1.0f;
+ popupEagle.score = EAGLESCORE;
+ popupEagle.active = true;
+ }
+ } break;
+ case FINALFORM:
+ {
+ if (transforming)
+ {
+ speedMod = 0;
+ transCount += 1*TIME_FACTOR;
+ transRotation += 1*TIME_FACTOR;
+ transAniCounter += 1*TIME_FACTOR;
+
+ thisFrameKoala += 1*TIME_FACTOR;
+
+ currentLeaves = LinearEaseIn((float)transCount, (float)initLeaves, (float)-LEAVESTOTRANSFORM, 120.0f);
+
+ if (thisFrameKoala >= 24)
+ {
+ curFrameKoala += 1;
+ thisFrameKoala = 0;
+ }
+
+ //if (curFrameKoala > 1) curFrameKoala = ;
+
+ if(curFrameKoala <= 1 )koalaAnimationTransform.x = gameplay_koala_transform.x + koalaAnimationTransform.width*curFrameKoala;
+
+ if (transAniCounter >= 5)
+ {
+ transBackAnim = !transBackAnim;
+ transAniCounter = 0;
+ }
+
+ if (transBackAnim)
+ {
+ finalColor = RED;
+ finalColor2 = WHITE;
+ }
+
+ if (!transBackAnim)
+ {
+ finalColor = WHITE;
+ finalColor2 = RED;
+ }
+
+ if (transCount >= 120)
+ {
+ transforming = false;
+ thisFrameKoala = 0;
+ curFrameKoala = 0;
+ speedFX.active = true;
+ //speedMod = 2;
+ transCount = 0;
+ //printf ("THIS ISN'T EVEN MY FINAL FORM");
+ bambooTimer += 15*TIME_FACTOR;
+ }
+ }
+ else if (!transforming)
+ {
+ speedMod = 5;
+ scrollSpeed = 3.2f*TIME_FACTOR;
+ power -= 1*TIME_FACTOR;
+
+ thisFrameKoala += 1*TIME_FACTOR;
+
+ if (thisFrameKoala >= 12)
+ {
+ curFrameKoala ++;
+ thisFrameKoala = 0;
+ }
+
+ if (curFrameKoala > 1) curFrameKoala = 0;
+ if (curFrameKoala <= 1) koalaAnimationFly.x = gameplay_koala_fly.x + koalaAnimationFly.width*curFrameKoala;
+ if (player.x > GetScreenWidth()/3) player.x -= 2;
+ if (player.x < GetScreenWidth()/3) player.x++;
+
+ if (power <= maxPower/5)
+ {
+ finalFormEnd += 1*TIME_FACTOR;
+ if (finalFormEnd >= 5)
+ {
+ transBackAnim = !transBackAnim;
+ finalFormEnd = 0;
+ }
+
+ if (transBackAnim)
+ {
+ finalColor = RED;
+ }
+
+ if (!transBackAnim)
+ {
+ finalColor = WHITE;
+ }
+ }
+ else finalColor = WHITE;
+
+#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
+ if ((IsGestureDetected(GESTURE_HOLD) || (GetGestureDetected() == GESTURE_DRAG)) && CheckCollisionPointRec(GetTouchPosition(0), leftButton)) player.y += FLYINGMOV;
+ if ((IsGestureDetected(GESTURE_HOLD) || (GetGestureDetected() == GESTURE_DRAG)) && CheckCollisionPointRec(GetTouchPosition(0), rightButton)) player.y -= FLYINGMOV;
+#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
+ if (IsKeyDown(KEY_DOWN) || (CheckCollisionPointRec(GetMousePosition(), leftButton) && IsMouseButtonDown(0))) player.y += FLYINGMOV;
+ if (IsKeyDown(KEY_UP) || (CheckCollisionPointRec(GetMousePosition(), rightButton) && IsMouseButtonDown(0))) player.y -= FLYINGMOV;
+#endif
+ }
+
+ gravity = 0;
+ grabCounter ++;
+
+ } break;
+ case ONWIND:
+ {
+ player.x -= jumpSpeed*TIME_FACTOR;
+ velocity -= 2*TIME_FACTOR;
+ player.y -= velocity;
+ framesCounter += 1*TIME_FACTOR;
+ grabCounter += 1*TIME_FACTOR;
+
+ } break;
+ default: break;
+ }
+
+ if (player.x <= (-player.width))
+ {
+ play = false;
+ playerActive = false;
+ killer = 4;
+ }
+
+ if ((player.y + player.height) >= GetScreenHeight())
+ {
+ if (state == FINALFORM) player.y = GetScreenHeight() - player.height;
+ else
+ {
+ play = false;
+ playerActive = false;
+ killer = 4;
+ }
+ }
+
+ if ((player.y) <= 0 && state == FINALFORM) player.y = 0;
+ if (player.x >= (GetScreenWidth() - player.width)) player.x = (GetScreenWidth() - player.width);
+ if (player.y <= -32) player.y = -32;
+
+ if (bambooTimer > bambooSpawnTime)
+ {
+ if (!transforming)
+ {
+ BambooSpawn();
+
+ if (state != FINALFORM && eagleDelay >= EAGLE_TIME_DELAY)EagleSpawn(EAGLE_SPAWNCHANCE);
+
+ switch (season)
+ {
+ case WINTER:
+ IceSpawn(ICESPAWNCHANCE);
+ OwlSpawn(OWLSPAWNCHANCE + (int)progresionSpawnChance);
+ break;
+ case SPRING:
+ ResinSpawn(RESINSPAWNCHANCE);
+ if (state != FINALFORM)BeeSpawn(BEE_SPAWNCHANCE);
+ DingoSpawn(DINGOSPAWNCHANCE + (int)progresionSpawnChance);
+ break;
+ case SUMMER:
+ FireSpawn(FIRESPAWNCHANCE);
+ SnakeSpawn(SNAKESPAWNCHANCE + (int)progresionSpawnChance);
+ break;
+ case FALL:
+ WindSpawn(WINDSPAWNCHANCE);
+ SnakeSpawn(SNAKESPAWNCHANCE + (int)progresionSpawnChance);
+ break;
+ default: break;
+ }
+
+ LeafSpawn();
+ }
+
+ bambooTimer = 0;
+ bambooSpawnTime = GetRandomValue(MINTIMESPAWN, MAXTIMESPAWN);
+ }
+ }
+ else if (!play && !playerActive)
+ {
+ if (score > hiscore) hiscore = score;
+
+ player.x -= jumpSpeed;
+ velocity -= 1*TIME_FACTOR;
+ player.y -= velocity;
+
+ if(player.y >= GetScreenHeight())
+ {
+ deathsCounter++;
+ finishScreen = 1;
+ }
+ }
+}
+
+// Gameplay Screen Draw logic
+void DrawGameplayScreen(void)
+{
+ BeginShaderMode(colorBlend);
+
+ DrawTexturePro(atlas02, gameplay_background, (Rectangle){0, 0, gameplay_background.width*2, gameplay_background.height*2}, (Vector2){0, 0}, 0, color02);
+
+ // Draw parallax
+ DrawParallaxBack();
+ DrawParallaxMiddle();
+
+ // Draw particles (only if active)
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (backSnowParticle.particles[i].active) DrawTexturePro(atlas02, particle_icecrystal_bw,
+ (Rectangle){ backSnowParticle.particles[i].position.x, backSnowParticle.particles[i].position.y, particle_icecrystal_bw.width*backSnowParticle.particles[i].size, particle_icecrystal_bw.height*backSnowParticle.particles[i].size },
+ (Vector2){ particle_icecrystal_bw.width*backSnowParticle.particles[i].size/2, particle_icecrystal_bw.height*backSnowParticle.particles[i].size/2 }, backSnowParticle.particles[i].rotation,
+ Fade((Color){144, 214, 255, 255}, backSnowParticle.particles[i].alpha));
+
+ if (backPlanetreeParticle.particles[i].active) DrawTexturePro(atlas02, particle_planetreeleaf_bw,
+ (Rectangle){ backPlanetreeParticle.particles[i].position.x, backPlanetreeParticle.particles[i].position.y, particle_planetreeleaf_bw.width*backPlanetreeParticle.particles[i].size, particle_planetreeleaf_bw.height*backPlanetreeParticle.particles[i].size },
+ (Vector2){ particle_planetreeleaf_bw.width*backPlanetreeParticle.particles[i].size/2, particle_planetreeleaf_bw.height*backPlanetreeParticle.particles[i].size/2 }, backPlanetreeParticle.particles[i].rotation,
+ Fade((Color){179, 86, 6, 255}, backPlanetreeParticle.particles[i].alpha));
+
+ if (dandelionBackParticle.particles[i].active) DrawTexturePro(atlas02, particle_dandelion_bw,
+ (Rectangle){ dandelionBackParticle.particles[i].position.x, dandelionBackParticle.particles[i].position.y, particle_dandelion_bw.width*dandelionBackParticle.particles[i].size, particle_dandelion_bw.height*dandelionBackParticle.particles[i].size },
+ (Vector2){ particle_dandelion_bw.width*dandelionBackParticle.particles[i].size/2, particle_dandelion_bw.height*dandelionBackParticle.particles[i].size/2 }, dandelionBackParticle.particles[i].rotation,
+ Fade((Color){202, 167, 126, 255}, dandelionBackParticle.particles[i].alpha));
+
+ if (backFlowerParticle.particles[i].active) DrawTexturePro(atlas02, particle_ecualyptusflower_bw,
+ (Rectangle){ backFlowerParticle.particles[i].position.x, backFlowerParticle.particles[i].position.y, particle_ecualyptusflower_bw.width*backFlowerParticle.particles[i].size, particle_ecualyptusflower_bw.height*backFlowerParticle.particles[i].size },
+ (Vector2){ particle_ecualyptusflower_bw.width*backFlowerParticle.particles[i].size/2, particle_ecualyptusflower_bw.height*backFlowerParticle.particles[i].size/2 }, backFlowerParticle.particles[i].rotation,
+ Fade((Color){218, 84, 108, 255}, backFlowerParticle.particles[i].alpha));
+
+ if (backRainParticle.particles[i].active) DrawTexturePro(atlas02, particle_waterdrop_bw,
+ (Rectangle){ backRainParticle.particles[i].position.x, backRainParticle.particles[i].position.y, particle_waterdrop_bw.width*backRainParticle.particles[i].size, particle_waterdrop_bw.height*backRainParticle.particles[i].size },
+ (Vector2){ particle_waterdrop_bw.width*backRainParticle.particles[i].size/2, particle_waterdrop_bw.height*backRainParticle.particles[i].size/2 }, backRainParticle.particles[i].rotation,
+ Fade((Color){144, 183, 187, 255}, backRainParticle.particles[i].alpha));
+ }
+
+ for (int i = 0; i < MAX_PARTICLES_RAY; i++)
+ {
+ if (backRayParticles.particles[i].active) DrawTexturePro(atlas02, gameplay_back_fx_lightraymid,
+ (Rectangle){ backRayParticles.particles[i].position.x, backRayParticles.particles[i].position.y, gameplay_back_fx_lightraymid.width*backRayParticles.particles[i].size, gameplay_back_fx_lightraymid.height*backRayParticles.particles[i].size },
+ (Vector2){ gameplay_back_fx_lightraymid.width*backRayParticles.particles[i].size/2, gameplay_back_fx_lightraymid.height*backRayParticles.particles[i].size/2 }, backRayParticles.particles[i].rotation,
+ Fade(backRayParticles.particles[i].color, backRayParticles.particles[i].alpha));
+ }
+
+ DrawParallaxFront();
+
+ for (int i = 0; i < MAX_BAMBOO; i++)
+ {
+ if (bambooActive[i])
+ {
+ DrawTexturePro(atlas02, gameplay_props_tree, (Rectangle){bamboo[i].x, bamboo[i].y, 43, 720}, (Vector2){0, 0}, 0, color03);
+ }
+ }
+
+ for (int i = 0; i < MAX_ENEMIES; i++)
+ {
+ if (branchActive[i])
+ {
+ DrawTexturePro(atlas02, gameplay_props_owl_branch, (Rectangle){branchPos[i].x, branchPos[i].y, 36, 20}, (Vector2){0, 0}, 0, color03);
+ }
+ }
+
+ EndShaderMode();
+
+ for (int i = 0; i < MAX_FIRE; i++)
+ {
+ DrawTexturePro(atlas01, (Rectangle){gameplay_props_burnttree.x, gameplay_props_burnttree.y + fire[i].y + gameplay_props_burnttree.height/14, gameplay_props_burnttree.width, gameplay_props_burnttree.height},
+ (Rectangle){fire[i].x + 5, fire[i].y + gameplay_props_burnttree.height/14, gameplay_props_burnttree.width, gameplay_props_burnttree.height}, (Vector2){0, 0}, 0, WHITE);
+ DrawTextureRec(atlas01, fireAnimation, (Vector2){fire[i].x, GetScreenHeight() - gameplay_props_burnttree.height/7}, WHITE);
+
+ for(int j = MAX_FIRE_FLAMES; j > -2; j--)
+ {
+ if ((fire[i].y - 25 <= (j*43)) && fireActive[i])
+ {
+ if (j%2 > 0)
+ {
+ DrawTextureRec(atlas01, fireAnimation, (Vector2){fire[i].x + fireOffset - 10, 40*j}, WHITE);
+ fireAnimation.x = gameplay_props_fire_spritesheet.x + fireAnimation.width*curFrame1;
+ }
+ else if (j%2 + 1 == 1)
+ {
+ DrawTextureRec(atlas01, fireAnimation, (Vector2){fire[i].x - fireOffset , 40*j}, WHITE);
+ fireAnimation.x = gameplay_props_fire_spritesheet.x + fireAnimation.width*curFrame2;
+ }
+ else
+ {
+ DrawTextureRec(atlas01, fireAnimation, (Vector2){fire[i].x - fireOffset , 40*j}, WHITE);
+ fireAnimation.x = gameplay_props_fire_spritesheet.x + fireAnimation.width*curFrame3;
+ }
+ }
+ }
+ }
+
+ for (int i = 0; i < MAX_ICE; i++)
+ {
+ if (iceActive[i]) for (int k = 0; k < GetScreenHeight(); k += (GetScreenHeight()/6)) DrawTexturePro(atlas01, gameplay_props_ice_sprite, (Rectangle){ice[i].x - 5, ice[i].y+k, gameplay_props_ice_sprite.width, gameplay_props_ice_sprite.height}, (Vector2){0,0}, 0, WHITE);
+ }
+
+ BeginShaderMode(colorBlend);
+
+ DrawTexturePro(atlas02, gameplay_back_ground00, (Rectangle){(int)groundPos + GetScreenWidth(), 637, gameplay_back_ground00.width*2, gameplay_back_ground00.height*2}, (Vector2){0,0}, 0, color00);
+ DrawTexturePro(atlas02, gameplay_back_ground00, (Rectangle){(int)groundPos, 637, gameplay_back_ground00.width*2, gameplay_back_ground00.height*2}, (Vector2){0,0}, 0, color00);
+
+ EndShaderMode();
+
+ for (int i = 0; i < MAX_RESIN; i++)
+ {
+ if (resinActive[i]) DrawTextureRec(atlas01, gameplay_props_resin_sprite,(Vector2){ resin[i].x - resin[i].width/3, resin[i].y - resin[i].height/5}, WHITE);
+ }
+
+ for (int i = 0; i < MAX_ENEMIES; i++)
+ {
+ if (snakeActive[i])
+ {
+ if (!isHitSnake[i])DrawTextureRec(atlas01, snakeAnimation, (Vector2){snake[i].x - snake[i].width, snake[i].y - snake[i].height/2}, WHITE);
+ else DrawTextureRec(atlas01, (Rectangle){gameplay_enemy_snake.x + snakeAnimation.width*2, gameplay_enemy_snake.y, snakeAnimation.width, snakeAnimation.height}, (Vector2){snake[i].x - snake[i].width/2, snake[i].y - snake[i].height/2}, WHITE);
+ }
+
+ if (dingoActive[i])
+ {
+ if (!isHitDingo[i]) DrawTextureRec(atlas01, dingoAnimation, (Vector2){dingo[i].x - dingo[i].width/2, dingo[i].y - dingo[i].height/4}, WHITE);
+ else DrawTextureRec(atlas01, (Rectangle){gameplay_enemy_dingo.x + dingoAnimation.width*2, gameplay_enemy_dingo.y, dingoAnimation.width, dingoAnimation.height}, (Vector2){dingo[i].x - dingo[i].width/2, dingo[i].y - dingo[i].height/4}, WHITE);
+ }
+
+ if (owlActive[i])
+ {
+ if (!isHitOwl[i])DrawTextureRec(atlas01, owlAnimation, (Vector2){owl[i].x - owl[i].width*0.7, owl[i].y - owl[i].height*0.1}, WHITE);
+ else DrawTextureRec(atlas01, (Rectangle){gameplay_enemy_owl.x + owlAnimation.width*2, gameplay_enemy_owl.y, owlAnimation.width, owlAnimation.height}, (Vector2){owl[i].x - owl[i].width/2, owl[i].y - owl[i].height/6}, WHITE);
+ }
+
+ if (enemyHit[i].active)
+ {
+ DrawTexturePro(atlas01, particle_hit,
+ (Rectangle){ enemyHit[i].position.x, enemyHit[i].position.y, particle_hit.width*enemyHit[i].size, particle_hit.height*enemyHit[i].size },
+ (Vector2){ particle_hit.width*enemyHit[i].size/2, particle_hit.height*enemyHit[i].size/2 }, enemyHit[i].rotation,
+ Fade(enemyHit[i].color, enemyHit[i].alpha));
+ }
+ }
+
+ // Only one bee / eagle / alert at the same time
+
+ for (int i = 0; i < MAX_LEAVES; i++)
+ {
+ if (leafActive[i])
+ {
+ if (leafSide[i])
+ {
+ if (leafType[i] == 0) DrawTextureRec(atlas01, (Rectangle){ gameplay_props_leaf_lil.x, gameplay_props_leaf_lil.y, -gameplay_props_leaf_lil.width, gameplay_props_leaf_lil.height }, (Vector2){ leaf[i].x, leaf[i].y - 15 }, WHITE);
+ else if (leafType[i] == 1) DrawTextureRec(atlas01, (Rectangle){ gameplay_props_leaf_lil.x, gameplay_props_leaf_lil.y, -gameplay_props_leaf_lil.width, gameplay_props_leaf_lil.height }, (Vector2){leaf[i].x, leaf[i].y + 10 }, WHITE);
+ else if (leafType[i] == 2) DrawTextureRec(atlas01, (Rectangle){ gameplay_props_leaf_mid.x, gameplay_props_leaf_mid.y, -gameplay_props_leaf_mid.width, gameplay_props_leaf_mid.height }, (Vector2){leaf[i].x, leaf[i].y - 15 }, WHITE);
+ else if (leafType[i] == 3) DrawTextureRec(atlas01, (Rectangle){ gameplay_props_leaf_big.x, gameplay_props_leaf_big.y, -gameplay_props_leaf_big.width, gameplay_props_leaf_big.height }, (Vector2){leaf[i].x, leaf[i].y - 15 }, WHITE);
+ }
+ else
+ {
+ if (leafType[i] == 0) DrawTextureRec(atlas01, gameplay_props_leaf_lil, (Vector2){ leaf[i].x - 25, leaf[i].y - 15 }, WHITE);
+ else if (leafType[i] == 1) DrawTextureRec(atlas01, gameplay_props_leaf_lil, (Vector2){leaf[i].x - 25, leaf[i].y + 10 }, WHITE);
+ else if (leafType[i] == 2) DrawTextureRec(atlas01, gameplay_props_leaf_mid, (Vector2){leaf[i].x - 25, leaf[i].y - 15 }, WHITE);
+ else if (leafType[i] == 3) DrawTextureRec(atlas01, gameplay_props_leaf_big, (Vector2){leaf[i].x - 25, leaf[i].y - 15 }, WHITE);
+ }
+#if defined(DEBUG)
+ DrawRectangle(leaf[i].x, leaf[i].y, 64, 64, Fade(GREEN, 0.5f));
+#endif
+ }
+
+ if (leafParticles[i].active)
+ {
+ for (int j = 0; j < 32; j++)
+ {
+ DrawTexturePro(atlas01, particle_ecualyptusleaf,
+ (Rectangle){ leafParticles[i].particles[j].position.x, leafParticles[i].particles[j].position.y, particle_ecualyptusleaf.width*leafParticles[i].particles[j].size, particle_ecualyptusleaf.height*leafParticles[i].particles[j].size },
+ (Vector2){ particle_ecualyptusleaf.width/2*leafParticles[i].particles[j].size, particle_ecualyptusleaf.height/2*leafParticles[i].particles[j].size }, leafParticles[i].particles[j].rotation, Fade(WHITE,leafParticles[i].particles[j].alpha));
+ }
+ }
+ }
+
+ if (beeActive && !isHitBee) DrawTextureRec(atlas01, beeAnimation, (Vector2){bee.x, bee.y - gameplay_enemy_bee.height/2}, WHITE);
+ else if (beeActive && isHitBee) DrawTexturePro(atlas01, (Rectangle){gameplay_enemy_bee.x + beeAnimation.width*4, gameplay_enemy_bee.y, beeAnimation.width, gameplay_enemy_bee.height},
+ (Rectangle){bee.x, bee.y, beeAnimation.width, gameplay_enemy_bee.height}, (Vector2){0, 0}, 0, WHITE);
+
+ if (eagleActive && !isHitEagle) DrawTextureRec(atlas01, eagleAnimation, (Vector2){eagle.x, eagle.y}, WHITE);
+ else if (eagleActive && isHitEagle) DrawTextureRec(atlas01, gameplay_enemy_eagle_death, (Vector2){eagle.x, eagle.y}, WHITE);
+
+ if (alertActive) DrawTexturePro(atlas01, gameplay_fx_eaglealert, alertRectangle, (Vector2){0, 0}, 0, Fade(RED, 0.7f));
+ if (alertBeeActive) DrawTexturePro(atlas01, gameplay_fx_eaglealert, beeAlertRectangle, (Vector2){0, 0}, 0, Fade(ORANGE, 0.7f));
+
+ if (transforming)
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ DrawTexturePro(atlas02, background_transformation,
+ (Rectangle){player.x + player.width/2 , player.y + player.height/2, background_transformation.width*4, background_transformation.height*4},
+ (Vector2){0, background_transformation.height*2}, 45*i, Fade(finalColor, 0.7f));
+ }
+
+ for (int i = 0; i < 8; i++)
+ {
+ DrawTexturePro(atlas02, background_transformation,
+ (Rectangle){player.x + player.width/2 , player.y + player.height/2, background_transformation.width*4, background_transformation.height},
+ (Vector2){0, background_transformation.height/2}, 22.5 + 45*i, Fade(finalColor2, 0.7f));
+ }
+ }
+
+ if (playerActive && play)
+ {
+ switch(state)
+ {
+ case GRABED: DrawTextureRec(atlas01, koalaAnimationIddle, (Vector2){player.x - player.width, player.y - gameplay_koala_idle.height/4}, WHITE); break;
+ case JUMPING: DrawTexturePro(atlas01, gameplay_koala_jump, (Rectangle){player.x - player.width, player.y - gameplay_koala_jump.height/4, gameplay_koala_jump.width, gameplay_koala_jump.height}, (Vector2){0, 0}, 0, WHITE); break;
+ case KICK:DrawTexturePro(atlas01, gameplay_koala_dash, (Rectangle){player.x - player.width, player.y - gameplay_koala_jump.height/4, gameplay_koala_dash.width, gameplay_koala_dash.height}, (Vector2){0, 0}, 0, WHITE); break;
+ case FINALFORM:
+ {
+ if(transforming)DrawTexturePro(atlas01, koalaAnimationTransform, (Rectangle){player.x - player.width, player.y - gameplay_koala_transform.height/4, gameplay_koala_transform.width/2, gameplay_koala_transform.height}, (Vector2){0, 0}, 0, finalColor);
+ else DrawTexturePro(atlas01, koalaAnimationFly, (Rectangle){player.x - gameplay_koala_fly.width/3, player.y - gameplay_koala_fly.height/4, gameplay_koala_fly.width/2, gameplay_koala_fly.height}, (Vector2){0, 0}, 0, finalColor);//DrawTextureRec((koalaFly), (Rectangle){0, 0, 128, 128}, (Vector2){player.x - 50, player.y - 40}, WHITE);
+
+ } break;
+ case ONWIND: DrawTexturePro(atlas01, gameplay_koala_jump, (Rectangle){player.x - player.width, player.y - gameplay_koala_jump.height/4, gameplay_koala_jump.width, gameplay_koala_jump.height}, (Vector2) { 0, 0}, 0, WHITE); break;
+ default: break;
+ }
+ }
+ else if (play == false && playerActive) DrawTextureRec(atlas01, (Rectangle){gameplay_koala_idle.x, gameplay_koala_idle.y, gameplay_koala_idle.width/3, gameplay_koala_idle.height}, (Vector2){player.x - player.width, player.y - gameplay_koala_idle.height/4}, WHITE);
+ else DrawTexturePro(atlas01, gameplay_koala_die, (Rectangle){player.x - player.width, player.y - gameplay_koala_die.height/4, gameplay_koala_die.width, gameplay_koala_die.height}, (Vector2) { 0, 0}, 0, WHITE);
+
+ for (int i = 0; i < MAX_WIND; i++)
+ {
+ if (windActive[i]) DrawTextureRec(atlas01, windAnimation, (Vector2){wind[i].x - 14, wind[i].y - 14}, WHITE);
+ }
+
+ if (playerActive && !play)
+ {
+ if (initSeason == 0) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade((Color){216, 200, 39, 255}, 0.4));
+ else if (initSeason == 1) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade((Color){155, 70, 22, 255}, 0.4));
+ else if (initSeason == 2) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade((Color){17, 129, 162, 255}, 0.4));
+ else DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade((Color){82, 174, 7, 255}, 0.4));
+ }
+
+ for (int i = 0; i < MAX_PARTICLES; i++)
+ {
+ if (snowParticle.particles[i].active) DrawTexturePro(atlas01, particle_icecrystal,
+ (Rectangle){ snowParticle.particles[i].position.x, snowParticle.particles[i].position.y, particle_icecrystal.width*snowParticle.particles[i].size, particle_icecrystal.height*snowParticle.particles[i].size },
+ (Vector2){ particle_icecrystal.width*snowParticle.particles[i].size/2, particle_icecrystal.height*snowParticle.particles[i].size/2 }, snowParticle.particles[i].rotation,
+ Fade(snowParticle.particles[i].color, snowParticle.particles[i].alpha));
+
+ if (planetreeParticle.particles[i].active) DrawTexturePro(atlas01, particle_planetreeleaf,
+ (Rectangle){ planetreeParticle.particles[i].position.x, planetreeParticle.particles[i].position.y, particle_planetreeleaf.width*planetreeParticle.particles[i].size, particle_planetreeleaf.height*planetreeParticle.particles[i].size },
+ (Vector2){ particle_planetreeleaf.width*planetreeParticle.particles[i].size/2, particle_planetreeleaf.height*planetreeParticle.particles[i].size/2 }, planetreeParticle.particles[i].rotation,
+ Fade(planetreeParticle.particles[i].color, planetreeParticle.particles[i].alpha));
+
+ if (dandelionParticle.particles[i].active) DrawTexturePro(atlas01, particle_dandelion,
+ (Rectangle){ dandelionParticle.particles[i].position.x, dandelionParticle.particles[i].position.y, particle_dandelion.width*dandelionParticle.particles[i].size, particle_dandelion.height*dandelionParticle.particles[i].size },
+ (Vector2){ particle_dandelion.width*dandelionParticle.particles[i].size/2, particle_dandelion.height*dandelionParticle.particles[i].size/2 }, dandelionParticle.particles[i].rotation,
+ Fade(dandelionParticle.particles[i].color, dandelionParticle.particles[i].alpha));
+
+ if (flowerParticle.particles[i].active) DrawTexturePro(atlas01, particle_ecualyptusflower,
+ (Rectangle){ flowerParticle.particles[i].position.x, flowerParticle.particles[i].position.y, particle_ecualyptusflower.width*flowerParticle.particles[i].size, particle_ecualyptusflower.height*flowerParticle.particles[i].size },
+ (Vector2){ particle_ecualyptusflower.width*flowerParticle.particles[i].size/2, particle_ecualyptusflower.height*flowerParticle.particles[i].size/2 }, flowerParticle.particles[i].rotation,
+ Fade(flowerParticle.particles[i].color, flowerParticle.particles[i].alpha));
+
+ if (rainParticle.particles[i].active) DrawTexturePro(atlas01, particle_waterdrop,
+ (Rectangle){ rainParticle.particles[i].position.x, rainParticle.particles[i].position.y, particle_waterdrop.width*rainParticle.particles[i].size, particle_waterdrop.height*rainParticle.particles[i].size },
+ (Vector2){ particle_waterdrop.width*rainParticle.particles[i].size/2, particle_waterdrop.height*rainParticle.particles[i].size/2 }, rainParticle.particles[i].rotation,
+ Fade(rainParticle.particles[i].color, rainParticle.particles[i].alpha));
+ }
+
+ // Draw Speed Particles
+ for (int i = 0; i < MAX_PARTICLES_SPEED; i++)
+ {
+ if (speedFX.particle[i].active) DrawRectangle(speedFX.particle[i].position.x, speedFX.particle[i].position.y, speedFX.particle[i].size.x, speedFX.particle[i].size.y , Fade(WHITE, speedFX.particle[i].alpha));
+ }
+
+ for (int i = 0; i < MAX_PARTICLES_STORM; i++)
+ {
+ if (rainStormParticle.particles[i].active) DrawTexturePro(atlas01, particle_waterdrop,
+ (Rectangle){ rainStormParticle.particles[i].position.x, rainStormParticle.particles[i].position.y, particle_waterdrop.width*rainStormParticle.particles[i].size, particle_waterdrop.height*rainStormParticle.particles[i].size },
+ (Vector2){ particle_waterdrop.width*rainStormParticle.particles[i].size/2, particle_waterdrop.height*rainStormParticle.particles[i].size/2 }, rainStormParticle.particles[i].rotation,
+ Fade(rainStormParticle.particles[i].color, rainStormParticle.particles[i].alpha));
+ }
+
+ for (int i = 0; i < MAX_PARTICLES_STORM; i++)
+ {
+ if (snowStormParticle.particles[i].active) DrawTexturePro(atlas01, particle_icecrystal,
+ (Rectangle){ snowStormParticle.particles[i].position.x, snowStormParticle.particles[i].position.y, particle_icecrystal.width*snowStormParticle.particles[i].size, particle_icecrystal.height*snowStormParticle.particles[i].size },
+ (Vector2){ particle_icecrystal.width*snowStormParticle.particles[i].size/2, particle_icecrystal.height*snowStormParticle.particles[i].size/2 }, snowStormParticle.particles[i].rotation,
+ Fade(snowStormParticle.particles[i].color, snowStormParticle.particles[i].alpha));
+ }
+
+ for (int i = 0; i < MAX_PARTICLES_RAY; i++)
+ {
+ if (rayParticles.particles[i].active) DrawTexturePro(atlas01, gameplay_fx_lightraymid,
+ (Rectangle){ rayParticles.particles[i].position.x, rayParticles.particles[i].position.y, gameplay_fx_lightraymid.width*rayParticles.particles[i].size, gameplay_fx_lightraymid.height*rayParticles.particles[i].size },
+ (Vector2){ gameplay_fx_lightraymid.width*rayParticles.particles[i].size/2, gameplay_fx_lightraymid.height*rayParticles.particles[i].size/2 }, rayParticles.particles[i].rotation,
+ Fade(rayParticles.particles[i].color, rayParticles.particles[i].alpha));
+ }
+
+ if (fogAlpha != 0)
+ {
+ DrawTexturePro(atlas02, background_fog02, (Rectangle){ fogPosition, GetScreenHeight()*0.6, GetScreenWidth(), background_fog02.height}, (Vector2){ 0 , 0 }, 0, Fade(WHITE, fogAlpha));
+ DrawTexturePro(atlas02, background_fog02, (Rectangle){ fogPosition+GetScreenWidth(), GetScreenHeight()*0.6, GetScreenWidth(), background_fog02.height}, (Vector2){ 0 , 0 }, 0, Fade(WHITE, fogAlpha));
+ }
+
+ if (filterAlpha != 0 && state != FINALFORM) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(SKYBLUE, filterAlpha));
+
+ DrawTexturePro(atlas01, gameplay_gui_leafcounter_base, (Rectangle){ 0, 0, gameplay_gui_leafcounter_base.width, gameplay_gui_leafcounter_base.height}, (Vector2){ 0 , 0 }, 0, WHITE);
+
+ DrawTexturePro(atlas01, gameplay_gui_seasonsclock_disc, (Rectangle) {GetScreenWidth(), 0, gameplay_gui_seasonsclock_disc.width, gameplay_gui_seasonsclock_disc.height}, (Vector2) {gameplay_gui_seasonsclock_disc.width/2, gameplay_gui_seasonsclock_disc.height/2}, // Draw a part of a texture defined by a rectangle with 'pro' parameters
+ clockRotation, Fade(WHITE, UIfade));
+
+ DrawTexturePro(atlas01, gameplay_gui_seasonsclock_base, (Rectangle){ (GetScreenWidth() - gameplay_gui_seasonsclock_base.width ), 0, gameplay_gui_seasonsclock_base.width, gameplay_gui_seasonsclock_base.height}, (Vector2){ 0 , 0 }, 0, Fade(WHITE, UIfade));
+
+ for (int i = 0; i < 20; i++)
+ {
+ if (((currentLeaves/5) > i) && (state != FINALFORM)) DrawTexturePro(atlas01, gameplay_gui_leafcounter_cell, (Rectangle) {87, 83, gameplay_gui_leafcounter_cell.width, gameplay_gui_leafcounter_cell.height}, (Vector2) {gameplay_gui_leafcounter_cell.width/4, 69}, i*(-18), WHITE);
+ else if ((power/18 >= i) && (state == FINALFORM)) DrawTexturePro(atlas01, gameplay_gui_leafcounter_cell, (Rectangle) {87, 83, gameplay_gui_leafcounter_cell.width, gameplay_gui_leafcounter_cell.height}, (Vector2) {gameplay_gui_leafcounter_cell.width/4, 69}, i*(-18), WHITE);
+ }
+
+ if ((currentLeaves >= LEAVESTOTRANSFORM) && (state != FINALFORM))
+ {
+ DrawTexturePro(atlas01, gameplay_gui_leafcounter_pulsel,
+ (Rectangle){ 85, 84, gameplay_gui_leafcounter_pulsel.width*leafGUIpulseScale, gameplay_gui_leafcounter_pulsel.height*leafGUIpulseScale},
+ (Vector2){ gameplay_gui_leafcounter_pulsel.width*leafGUIpulseScale/2 , gameplay_gui_leafcounter_pulsel.height*leafGUIpulseScale/2 }, 0, Fade((Color){126, 248, 25, 255}, leafGUIpulseFade));
+
+ DrawTexturePro(atlas01, gameplay_gui_leafcounter_glow,
+ (Rectangle){ 84, 83, gameplay_gui_leafcounter_glow.width, gameplay_gui_leafcounter_glow.height},
+ (Vector2){ gameplay_gui_leafcounter_glow.width/2 , gameplay_gui_leafcounter_glow.height/2 }, 0, Fade(WHITE, leafGUIglowFade));
+ }
+
+ if ((play == false) && playerActive)
+ {
+ if (startNum == 3) DrawTexturePro(atlas01, gameplay_countdown_3,
+ (Rectangle){ GetScreenWidth()/2, GetScreenHeight()/2, gameplay_countdown_3.width*numberScale, gameplay_countdown_3.height*numberScale},
+ (Vector2){ gameplay_countdown_3.width*numberScale/2 , gameplay_countdown_3.height*numberScale/2 }, 0, Fade(RED, numberAlpha));
+ else if (startNum == 2) DrawTexturePro(atlas01, gameplay_countdown_2,
+ (Rectangle){ GetScreenWidth()/2, GetScreenHeight()/2, gameplay_countdown_2.width*numberScale, gameplay_countdown_2.height*numberScale},
+ (Vector2){ gameplay_countdown_2.width*numberScale/2 , gameplay_countdown_2.height*numberScale/2 }, 0, Fade(RED, leafGUIpulseFade));
+ else if (startNum == 1) DrawTexturePro(atlas01, gameplay_countdown_1,
+ (Rectangle){ GetScreenWidth()/2, GetScreenHeight()/2, gameplay_countdown_1.width*numberScale, gameplay_countdown_1.height*numberScale},
+ (Vector2){ gameplay_countdown_1.width*numberScale/2 , gameplay_countdown_1.height*numberScale/2 }, 0, Fade(RED, leafGUIpulseFade));
+ }
+
+ // Draw text elements
+ //--------------------------
+ for (int i = 0; i < MAX_ENEMIES; i++)
+ {
+ if (popupScore[i].active)
+ {
+ DrawTextEx(font, FormatText("%i", popupScore[i].score), popupScore[i].position, font.size/4*popupScore[i].scale, -5, Fade((Color){255, 73, 73, 255}, popupScore[i].alpha));
+ }
+ }
+
+ if (popupBee.active) DrawTextEx(font, FormatText("%i", popupBee.score), popupBee.position, font.size/4*popupBee.scale, -5, Fade((Color){255, 73, 73, 255}, popupBee.alpha));
+ if (popupEagle.active) DrawTextEx(font, FormatText("%i", popupEagle.score), popupEagle.position, font.size/4*popupEagle.scale, -5, Fade((Color){255, 73, 73, 255}, popupEagle.alpha));
+
+ for (int i = 0; i < MAX_LEAVES; i++)
+ {
+ if (popupLeaves[i].active) DrawTextEx(font, FormatText("+ %i", popupLeaves[i].score), popupLeaves[i].position, font.size/4*popupLeaves[i].scale, -5, Fade((Color){139, 179, 0, 255}, popupLeaves[i].alpha));
+ }
+
+
+ DrawTextEx(font, FormatText("%03i", currentLeaves), (Vector2){ 47, 50 }, font.size, -8, counterColor);
+
+ if (transforming) DrawTextEx(font, textFinalForm, (Vector2){ GetScreenWidth()/2 - MeasureText(textFinalForm, 40)/2, GetScreenHeight()/4}, font.size, -5, (Color){246, 133, 133, 255});
+
+ if ((currentMonth == 7) && (transitionFramesCounter >= SEASONTRANSITION/2))
+ {
+ if (randomMessage <= 4) DrawTextEx(font, textSpring1, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){185, 222, 105, 255});
+ else DrawTextEx(font, textSpring2, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){185, 222, 105, 255});
+ }
+ else if ((currentMonth == 10) && (transitionFramesCounter >= SEASONTRANSITION/2))
+ {
+ if (randomMessage <= 4) DrawTextEx(font, textSummer1, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){253, 200, 108, 255});
+ else DrawTextEx(font, textSummer2, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){253, 200, 108, 255});
+ }
+ else if ((currentMonth == 1) && (transitionFramesCounter >= SEASONTRANSITION/2))
+ {
+ if (randomMessage <= 4) DrawTextEx(font, textFall1, (Vector2){GetScreenWidth()/2 - MeasureText(textFall1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){255, 149, 107, 255});
+ else DrawTextEx(font, textFall2, (Vector2){GetScreenWidth()/2 - MeasureText(textFall2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){255, 149, 107, 255});
+ }
+ else if (currentMonth == 4 && transitionFramesCounter >= SEASONTRANSITION/2)
+ {
+ if (randomMessage <= 4) DrawTextEx(font, textWinter1, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){133, 249, 253, 255});
+ else DrawTextEx(font, textWinter2, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){133, 249, 253, 255});
+ }
+
+#if defined(DEBUG)
+ DrawRectangle(player.x, player.y, player.width, player.height, Fade(WHITE, 0.5));
+
+ for (int i = 0; i < MAX_WIND; i++)
+ {
+ if (windActive[i]) DrawRectangleRec(wind[i], Fade (GRAY, 0.4));
+ }
+
+ for (int i = 0; i < MAX_ENEMIES; i++)
+ {
+ if (owlActive[i]) DrawRectangleRec(owl[i], Fade(BLACK, 0.5f));
+ if (dingoActive[i]) DrawRectangleRec(dingo[i], Fade(BLACK, 0.5f));
+ if (snakeActive[i]) DrawRectangleRec(snake[i], BLACK);
+ }
+
+ if (beeActive) DrawRectangleRec(bee, Fade(BLACK, 0.5f));
+ if (eagleActive) DrawRectangleRec(eagle, Fade(BLACK, 0.5f));
+
+ switch (season)
+ {
+ case WINTER:
+ {
+ if (currentMonth == 5) DrawText("June", GetScreenWidth() - 140, GetScreenHeight() - 20, 20, RED);
+ if (currentMonth == 6) DrawText("July", GetScreenWidth() - 140, GetScreenHeight() - 20, 20, RED);
+
+ } break;
+ case SPRING:
+ {
+ if (currentMonth == 8) DrawText("September", GetScreenWidth() - 140, GetScreenHeight() - 20, 20, RED);
+ if (currentMonth == 9) DrawText("October", GetScreenWidth() - 140, GetScreenHeight() - 20, 20, RED);
+
+ } break;
+ case SUMMER:
+ {
+ if (currentMonth == 11) DrawText("December", GetScreenWidth() - 140, GetScreenHeight() - 20, 20, RED);
+ if (currentMonth == 0) DrawText("January", GetScreenWidth() - 140, GetScreenHeight() - 20, 20, RED);
+
+ } break;
+ case FALL:
+ {
+ if (currentMonth == 2) DrawText("March", GetScreenWidth() - 140, GetScreenHeight() - 20, 20, RED);
+ if (currentMonth == 3) DrawText("April", GetScreenWidth() - 140, GetScreenHeight() - 20, 20, RED);
+
+ } break;
+ case TRANSITION:
+ {
+ if (currentMonth == 4) DrawText("May", GetScreenWidth() - 140, GetScreenHeight() - 20, 20, RED);
+
+ } break;
+ default: break;
+ }
+
+ DrawText(FormatText("Score: %02i", score), 140, GetScreenHeight() - 20, 20, RED);
+ DrawText(FormatText("HighScore: %02i", hiscore), 600, GetScreenHeight() - 20, 20, RED);
+ DrawText(FormatText("SeasonChange: %03i", seasonTimer), 300, GetScreenHeight() - 20, 20, RED);
+#endif
+}
+
+// Gameplay Screen Unload logic
+void UnloadGameplayScreen(void)
+{
+ // ...
+}
+
+// Gameplay Screen should finish?
+int FinishGameplayScreen(void)
+{
+ return finishScreen;
+}
+
+// Tree Spawn
+static void BambooSpawn(void)
+{
+ int counter = 0;
+
+ for (int k = 0; k < MAX_ENEMIES; k++)
+ {
+ if ((!bambooActive[k]) && (counter < 1))
+ {
+ bamboo[k].y = 0;
+ bamboo[k].x = GetScreenWidth();
+ bambooActive[k] = true;
+ counter++;
+ }
+ }
+}
+
+//Snake Spawn
+static void SnakeSpawn(int chance)
+{
+ int position;
+ int counter = 0;
+
+ for (int z = 0; z < 2; z++) posArray[z] = -1;
+
+ if (GetRandomValue(0, 100) <= chance)
+ {
+ for (int k = 0; k < MAX_ENEMIES; k++)
+ {
+ if ((!snakeActive[k]) && (counter < 1))
+ {
+ position = GetRandomValue(0, 4);
+
+ if (counter == 0) posArray[counter] = position;
+
+ snake[k].x = GetScreenWidth() - 15;
+ snake[k].y = 25 + GetScreenHeight()/5*position;
+ snakeActive[k] = true;
+ isHitSnake[k] = false;
+ counter++;
+ }
+ }
+ }
+}
+
+// Dingo Spawn
+static void DingoSpawn(int chance)
+{
+ int position;
+ int counter = 0;
+
+ for (int z = 0; z < 2; z++) posArrayDingo[z] = -1;
+
+ if (GetRandomValue(0, 100) <= chance)
+ {
+ for(int k = 0; k < MAX_ENEMIES; k++)
+ {
+ if ((!dingoActive[k]) && (counter < 1))
+ {
+ position = GetRandomValue(1, 3);
+
+ if (counter == 0) posArray[counter] = position;
+
+ dingo[k].x = GetScreenWidth() - 15;
+ dingo[k].y = 25 + GetScreenHeight()/5*position;
+ dingoActive[k] = true;
+ isHitDingo[k] = false;
+ counter++;
+ }
+ }
+ }
+}
+
+// Owl Spawn
+static void OwlSpawn(int chance)
+{
+ int position;
+ int counter = 0;
+
+ for (int z = 0; z < 2; z++) posArray[z] = -1;
+
+ if (GetRandomValue(0, 100) <= chance)
+ {
+ for (int k = 0; k < MAX_ENEMIES; k++)
+ {
+ if ((!owlActive[k]) && (!branchActive[k]) && (counter < 1))
+ {
+ position = GetRandomValue(1, 3);
+
+ if (counter == 0) posArray[counter] = position;
+
+ owl[k].x = GetScreenWidth() - 15;
+ owl[k].y = 25 + GetScreenHeight()/5*position;
+ owlActive[k] = true;
+ branchPos[k].x = owl[k].x;
+ branchPos[k].y = owl[k].y + 64;
+ branchActive[k] = true;
+ counter++;
+ }
+ }
+ }
+}
+
+// Leaf spawn function
+static void LeafSpawn(void)
+{
+ int counter = 0;
+ int maxLeavesCounter = GetRandomValue(0, 2);
+
+ for (int z = 0; z < 2; z++) posArrayLeaf[z] = -1;
+
+ for (int k = 0; k < MAX_LEAVES; k++)
+ {
+ if ((!leafActive[k]) && (counter <= maxLeavesCounter))
+ {
+ int leafPosition = GetRandomValue(0, 4);
+ int leafTypeSelection = GetRandomValue(0,99);
+ int leafSideSelection = GetRandomValue(0,1);
+ leafSide[k] = leafSideSelection;
+
+ if (counter == 0)
+ {
+ while (CheckArrayValue(posArray, 2, leafPosition)) leafPosition = GetRandomValue(0, 4);
+ posArrayLeaf[counter] = leafPosition;
+ }
+ else if (counter == 1)
+ {
+ while(leafPosition == posArrayLeaf[counter - 1] || CheckArrayValue(posArray, 2, leafPosition)) leafPosition = GetRandomValue(0, 4);
+ posArrayLeaf[counter] = leafPosition;
+ }
+ else if (counter == 2)
+ {
+ while((leafPosition == posArrayLeaf[counter - 1] || (leafPosition == posArrayLeaf[counter - 2])) || CheckArrayValue(posArray, 2, leafPosition)) leafPosition = GetRandomValue(0, 4);
+ posArrayLeaf[counter] = leafPosition;
+ }
+
+ leaf[k].y = 30 + GetScreenHeight()/5*leafPosition;
+ leaf[k].x = GetScreenWidth() - 18;
+ leafActive[k] = true;
+
+ if (leafTypeSelection <= 24) leafType[k] = 0;
+ else if ((leafTypeSelection > 24) && leafTypeSelection <= 50) leafType[k] = 1;
+ else if ((leafTypeSelection > 50) && leafTypeSelection <= 75) leafType[k] = 2;
+ else leafType[k] = 3;
+
+ counter++;
+ }
+ }
+}
+
+static void FireSpawn(int chance)
+{
+ int counter = 0;
+
+ if (GetRandomValue(0, 100) <= chance)
+ {
+ for (int k = 0; k < MAX_FIRE; k++)
+ {
+ if ((!fireActive[k]) && (counter < 1))
+ {
+ fire[k].y = GetScreenHeight() - 30;
+ fire[k].x = GetScreenWidth() - 5;
+ //fire[k].height = 30;
+ fireActive[k] = true;
+ onFire[k] = false;
+ counter++;
+ }
+ }
+ }
+}
+
+static void IceSpawn(int chance)
+{
+ int counter = 0;
+
+ if (GetRandomValue(0, 100) <= chance)
+ {
+ for (int k = 0; k < MAX_ICE; k++)
+ {
+ if ((!iceActive[k]) && (counter < 1))
+ {
+ ice[k].y = 0;
+ ice[k].x = GetScreenWidth() + 5;
+ iceActive[k] = true;
+ counter++;
+ }
+ }
+ }
+}
+
+static void ResinSpawn(int chance)
+{
+ int counter = 0;
+
+ if (GetRandomValue(0, 100) <= chance)
+ {
+ for (int k = 0; k < MAX_RESIN; k++)
+ {
+ if ((!resinActive[k]) && (counter < 1))
+ {
+ int resPosition = GetRandomValue(0, 4);
+
+ while (CheckArrayValue(posArray, 2, resPosition)) resPosition = GetRandomValue(0, 4);
+
+ resin[k].y = 25 + GetScreenHeight()/5*resPosition;
+ resin[k].x = GetScreenWidth() + 5;
+ resinActive[k] = true;
+ counter++;
+ }
+ }
+ }
+}
+
+static void WindSpawn(int chance)
+{
+ int counter = 0;
+
+ if (GetRandomValue(0, 100) <= chance)
+ {
+ for (int k = 0; k < MAX_WIND ; k++)
+ {
+ if ((!windActive[k]) && (counter < 1))
+ {
+ int resPosition = GetRandomValue(0, 4);
+
+ while (CheckArrayValue(posArray, 2, resPosition)) resPosition = GetRandomValue(0, 4);
+
+ wind[k].y = 25 + GetScreenHeight()/5*resPosition;
+ wind[k].x = GetScreenWidth() + 5;
+ windActive[k] = true;
+ counter++;
+ }
+ }
+ }
+}
+
+// Spawn bee enemy
+static void BeeSpawn(int chance)
+{
+ if ((GetRandomValue(0, 100) <= chance) && !beeActive && !alertBeeActive)
+ {
+ bee.x = GetScreenWidth();
+ bee.y = GetRandomValue(40, GetScreenHeight() - bee.height - 40);
+ beeAlertRectangle = (Rectangle){GetScreenWidth(), bee.y + gameplay_enemy_bee.height/2, 0, 0};
+ beeActive = false;
+ alertBeeActive = true;
+ }
+}
+
+// Spawn eagle enemy
+static void EagleSpawn(int chance)
+{
+ if ((GetRandomValue(0, 100) <= chance) && !eagleActive && !alertActive)
+ {
+ eagleDelay = 0;
+ eagle.x = GetScreenWidth();
+ eagle.y = player.y;
+ alertRectangle = (Rectangle){GetScreenWidth(), eagle.y + gameplay_enemy_eagle.height/2, 0, 0};
+ eagleActive = false;
+ eagleAlert = true;
+ alertActive = true;
+ }
+}
+
+// Check if the array contains a value
+static bool CheckArrayValue(int *array, int arrayLength, int value)
+{
+ for (int n = 0; n < arrayLength; n++)
+ {
+ if (array[n] == value) return 1;
+ }
+
+ return 0;
+}
+
+// Scroll functions
+// Front parallax drawing
+static void DrawParallaxFront(void)
+{
+ Rectangle ground01 = gameplay_back_ground01;
+
+ DrawTexturePro(atlas02, gameplay_back_tree01_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset, 60, gameplay_back_tree01_layer01.width*2, gameplay_back_tree01_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree02_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + 140, 60, gameplay_back_tree02_layer01.width*2, gameplay_back_tree02_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree03_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + 140*2, 55, gameplay_back_tree02_layer01.width*2, gameplay_back_tree02_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree04_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + 140*3, 60, gameplay_back_tree04_layer01.width*2, gameplay_back_tree04_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree05_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + 140*4, 60, gameplay_back_tree05_layer01.width*2, gameplay_back_tree05_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree06_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + 140*5, 55, gameplay_back_tree06_layer01.width*2, gameplay_back_tree06_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree07_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + 140*6, 60, gameplay_back_tree07_layer01.width*2, gameplay_back_tree07_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree08_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + 140*7, 60, gameplay_back_tree08_layer01.width*2, gameplay_back_tree08_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_ground01, (Rectangle){(int)scrollFront, 559, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
+ DrawTexturePro(atlas02, (Rectangle){ground01.x, ground01.y + ground01.height, ground01.width, -ground01.height}, (Rectangle){(int)scrollFront, -33, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
+
+ DrawTexturePro(atlas02, gameplay_back_tree01_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + GetScreenWidth(), 60, gameplay_back_tree01_layer01.width*2, gameplay_back_tree01_layer01.height*2},(Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree02_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + GetScreenWidth() + 140, 60, gameplay_back_tree02_layer01.width*2, gameplay_back_tree02_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree03_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + GetScreenWidth() + 140*2, 55, gameplay_back_tree03_layer01.width*2, gameplay_back_tree03_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree04_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + GetScreenWidth() + 140*3, 60, gameplay_back_tree04_layer01.width*2, gameplay_back_tree04_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree05_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + GetScreenWidth() + 140*4, 60, gameplay_back_tree05_layer01.width*2, gameplay_back_tree05_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree06_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + GetScreenWidth() + 140*5, 55, gameplay_back_tree06_layer01.width*2, gameplay_back_tree06_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree07_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset + GetScreenWidth() + 140*6, 60, gameplay_back_tree07_layer01.width*2, gameplay_back_tree07_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree08_layer01, (Rectangle){(int)scrollFront + parallaxFrontOffset+ GetScreenWidth() + 140*7, 60, gameplay_back_tree08_layer01.width*2, gameplay_back_tree08_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_ground01, (Rectangle){(int)scrollFront + GetScreenWidth(), 559, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
+ DrawTexturePro(atlas02, (Rectangle){ground01.x, ground01.y + ground01.height, ground01.width, -ground01.height}, (Rectangle){(int)scrollFront+ GetScreenWidth(), -33, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
+}
+
+// Middle parallax drawing
+static void DrawParallaxMiddle(void)
+{
+ Rectangle ground02 = gameplay_back_ground02;
+
+ DrawTexturePro(atlas02, gameplay_back_tree01_layer02, (Rectangle){(int)scrollMiddle, 67, gameplay_back_tree01_layer02.width*2, gameplay_back_tree01_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree02_layer02, (Rectangle){(int)scrollMiddle + 140, 67, gameplay_back_tree02_layer02.width*2, gameplay_back_tree02_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree03_layer02, (Rectangle){(int)scrollMiddle + 140*2, 67, gameplay_back_tree03_layer02.width*2, gameplay_back_tree03_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree04_layer02, (Rectangle){(int)scrollMiddle + 140*3, 67, gameplay_back_tree04_layer02.width*2, gameplay_back_tree04_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree05_layer02, (Rectangle){(int)scrollMiddle + 140*4, 67, gameplay_back_tree05_layer02.width*2, gameplay_back_tree05_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree06_layer02, (Rectangle){(int)scrollMiddle + 140*5, 67, gameplay_back_tree06_layer02.width*2, gameplay_back_tree06_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree07_layer02, (Rectangle){(int)scrollMiddle + 140*6, 67, gameplay_back_tree07_layer02.width*2, gameplay_back_tree07_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree08_layer02, (Rectangle){(int)scrollMiddle + 140*7, 67, gameplay_back_tree08_layer02.width*2, gameplay_back_tree08_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_ground02, (Rectangle){(int)scrollMiddle, 509, ground02.width*2, ground02.height*2}, (Vector2){0,0}, 0, color01);
+ DrawTexturePro(atlas02, (Rectangle){ground02.x, ground02.y + ground02.height, ground02.width, -ground02.height}, (Rectangle){(int)scrollMiddle, 19, ground02.width*2, ground02.height*2}, (Vector2){0,0}, 0, color01);
+
+ DrawTexturePro(atlas02, gameplay_back_tree02_layer02, (Rectangle){(int)scrollMiddle + GetScreenWidth() + 140, 67, gameplay_back_tree02_layer02.width*2, gameplay_back_tree02_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree03_layer02, (Rectangle){(int)scrollMiddle + GetScreenWidth() + 140*2, 67, gameplay_back_tree03_layer02.width*2, gameplay_back_tree03_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree04_layer02, (Rectangle){(int)scrollMiddle + GetScreenWidth() + 140*3, 67, gameplay_back_tree04_layer02.width*2, gameplay_back_tree04_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree05_layer02, (Rectangle){(int)scrollMiddle + GetScreenWidth() + 140*4, 67, gameplay_back_tree05_layer02.width*2, gameplay_back_tree05_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree06_layer02, (Rectangle){(int)scrollMiddle + GetScreenWidth() + 140*5, 67, gameplay_back_tree06_layer02.width*2, gameplay_back_tree06_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree07_layer02, (Rectangle){(int)scrollMiddle + GetScreenWidth() + 140*6, 67, gameplay_back_tree07_layer02.width*2, gameplay_back_tree07_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree08_layer02, (Rectangle){(int)scrollMiddle + GetScreenWidth() + 140*7, 67, gameplay_back_tree08_layer02.width*2, gameplay_back_tree08_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree01_layer02, (Rectangle){(int)scrollMiddle+ GetScreenWidth(), 67, gameplay_back_tree01_layer02.width*2, gameplay_back_tree01_layer02.height*2},(Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_ground02, (Rectangle){(int)scrollMiddle + GetScreenWidth(), 509, ground02.width*2, ground02.height*2},(Vector2){0,0}, 0, color01);
+ DrawTexturePro(atlas02, (Rectangle){ground02.x, ground02.y + ground02.height, ground02.width, -ground02.height}, (Rectangle){(int)scrollMiddle+ GetScreenWidth(), 19, ground02.width*2, ground02.height*2}, (Vector2){0,0}, 0, color01);
+}
+
+// Back parallax drawing
+static void DrawParallaxBack(void)
+{
+ Rectangle ground03 = gameplay_back_ground03;
+
+ DrawTexturePro(atlas02, gameplay_back_tree01_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset, 67, gameplay_back_tree01_layer03.width*2, gameplay_back_tree01_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree02_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + 140, 67, gameplay_back_tree02_layer03.width*2, gameplay_back_tree02_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree03_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + 140*2, 67, gameplay_back_tree03_layer03.width*2, gameplay_back_tree03_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree04_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + 140*3, 67, gameplay_back_tree04_layer03.width*2, gameplay_back_tree04_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree05_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + 140*4, 67, gameplay_back_tree05_layer03.width*2, gameplay_back_tree05_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree06_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + 140*5, 67, gameplay_back_tree06_layer03.width*2, gameplay_back_tree06_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree07_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + 140*6, 67, gameplay_back_tree07_layer03.width*2, gameplay_back_tree07_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree08_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + 140*7, 67, gameplay_back_tree08_layer03.width*2, gameplay_back_tree08_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_ground03, (Rectangle){(int)scrollBack, 469, ground03.width*2, ground03.height*2}, (Vector2){0,0}, 0, color01);
+ DrawTexturePro(atlas02, (Rectangle){ground03.x, ground03.y + ground03.height, ground03.width, -ground03.height}, (Rectangle){(int)scrollBack, 67, ground03.width*2, ground03.height*2}, (Vector2){0,0}, 0, color01);
+
+ DrawTexturePro(atlas02, gameplay_back_tree01_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset+ GetScreenWidth(), 67, gameplay_back_tree01_layer03.width*2, gameplay_back_tree01_layer03.height*2},(Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree02_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + GetScreenWidth() + 140, 67, gameplay_back_tree02_layer03.width*2, gameplay_back_tree02_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree03_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + GetScreenWidth() + 140*2, 67, gameplay_back_tree03_layer03.width*2, gameplay_back_tree03_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree04_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + GetScreenWidth() + 140*3, 67, gameplay_back_tree04_layer03.width*2, gameplay_back_tree04_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree05_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + GetScreenWidth() + 140*4, 67, gameplay_back_tree05_layer03.width*2, gameplay_back_tree05_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree06_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + GetScreenWidth() + 140*5, 67, gameplay_back_tree06_layer03.width*2, gameplay_back_tree06_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree07_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + GetScreenWidth() + 140*6, 67, gameplay_back_tree07_layer03.width*2, gameplay_back_tree07_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree08_layer03, (Rectangle){(int)scrollBack + parallaxBackOffset + GetScreenWidth() + 140*7, 67, gameplay_back_tree08_layer03.width*2, gameplay_back_tree08_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_ground03, (Rectangle){(int)scrollBack + GetScreenWidth(), 469, ground03.width*2, ground03.height*2}, (Vector2){0,0}, 0, color01);
+ DrawTexturePro(atlas02, (Rectangle){ground03.x, ground03.y + ground03.height, ground03.width, -ground03.height}, (Rectangle){(int)scrollBack+ GetScreenWidth(), 67, ground03.width*2, ground03.height*2}, (Vector2){0,0}, 0, color01);
+}
+
+// Linear easing animation
+static float LinearEaseIn(float t, float b, float c, float d) { return c*t/d + b; }
+
+// Transition from one color to another
+static Color ColorTransition(Color initialColor, Color finalColor, int framesCounter)
+{
+ Color currentColor;
+
+ currentColor.r = (unsigned char)LinearEaseIn((float)framesCounter, (float)initialColor.r, (float)(finalColor.r - initialColor.r), (float)(SEASONTRANSITION));
+ currentColor.g = (unsigned char)LinearEaseIn((float)framesCounter, (float)initialColor.g, (float)(finalColor.g - initialColor.g), (float)(SEASONTRANSITION));
+ currentColor.b = (unsigned char)LinearEaseIn((float)framesCounter, (float)initialColor.b, (float)(finalColor.b - initialColor.b), (float)(SEASONTRANSITION));
+ currentColor.a = 255;
+
+ return currentColor;
+}
+
+static void Reset(void)
+{
+ framesCounter = 0;
+ finishScreen = 0;
+ grabCounter = 10;
+ bambooTimer = 0;
+ bambooSpawnTime = 0;
+ gravity = 5;
+ speed = 3;
+ score = 0;
+ hiscore = 0;
+ power = 360;
+ resinCount = 0;
+ rightAlpha = 0.5;
+ leftAlpha = 0.5;
+ speedMod = 1.2f;
+ transCount = 0;
+ windCounter = 0;
+ maxPower = 360;
+ playerActive = true;
+ scrollFront = 0;
+ scrollMiddle = 0;
+ scrollBack = 0;
+ scrollSpeed = 1.6f*TIME_FACTOR;
+ groundPos = 0;
+ resinCountjump = 0;
+ resinCountdrag = 0;
+ colorTimer = 0;
+ play = false;
+ onIce = false;
+ onResin = false;
+ jumpSpeed = 6;
+ transforming = false;
+ eagleAlert = false;
+ alertActive = false;
+ fireSpeed = 4;
+ seasonTimer = 0;
+ seasonChange = SEASONCHANGE;
+ monthChange = seasonChange/3;
+ glowing = true;
+ currentFrame = 0;
+ curFrame = 0;
+ curFrame1 = 1;
+ curFrame2 = 2;
+ curFrame3 = 3;
+ curFrameBee = 0;
+ fireOffset = 20;
+ beeMov = 0;
+ killCounter = 0;
+ currentLeaves = 0;
+ clockRotation = 0;
+ flyColor = GRAY;
+ globalFrameCounter = 0;
+ startCounter = 0;
+ numberAlpha = 1;
+ numberScale = 2.5f;
+ startNum = 3;
+ animCounter = 0;
+ finalFormEnd = 0;
+ randomMessage = 0;
+ years = 0;
+ UIfade = 1;
+ fogAlpha = 0;
+ seasons = 0;
+ fog = false;
+ clockSpeedRotation = 0;
+ eagleDelay = 0;
+
+ parallaxBackOffset = GetRandomValue (10, 100);
+ parallaxFrontOffset = GetRandomValue (100, 200);
+
+ progresionDelay = 0;
+ progresionFramesCounter = 0;
+ speedProgresion = 0;
+
+ jumpCounter = 0;
+ resinCounter = 0;
+ tornadoCounter = 0;
+ dashCounter = 0;
+ superKoalaCounter = 0;
+
+ fogSpeed = 2;
+
+ leafGUIglow = true;
+ leafGUIglowFade = 0;
+ leafGUIpulseFade = 1;
+ leafGUIpulseScale = 1;
+
+ //initMonth = ptm->tm_mon;
+ initYears = 1900 + ptm->tm_year;
+
+ //initMonth = STARTINGMONTH;
+
+ if (initSeason == 0)
+ {
+ initMonth = 11;
+ clockRotation = 225;
+ clockInitRotation = 225;
+ clockFinalRotation = clockInitRotation + 90;
+ color00 = (Color){129, 172, 86, 255}; // Summer Color
+ color01 = (Color){145, 165, 125, 255};
+ color02 = (Color){161, 130, 73, 255};
+ color03 = (Color){198, 103, 51, 255};
+ }
+ else if (initSeason == 1)
+ {
+ initMonth = 2;
+ clockRotation = 315;
+ clockInitRotation = 315;
+ clockFinalRotation = clockInitRotation + 90;
+ color00 = (Color){242, 113, 62, 255}; // Fall Color
+ color01 = (Color){190, 135, 114, 255};
+ color02 = (Color){144, 130, 101, 255};
+ color03 = (Color){214, 133, 58, 255};
+ }
+ else if (initSeason == 2)
+ {
+ initMonth = 5;
+ clockRotation = 45;
+ clockInitRotation = 45;
+ clockFinalRotation = clockInitRotation + 90;
+ color00 = (Color){130, 130, 181, 255}; // Winter Color
+ color01 = (Color){145, 145, 166, 255};
+ color02 = (Color){104, 142, 144, 255};
+ color03 = (Color){57, 140, 173, 255};
+ }
+ else if (initSeason == 3)
+ {
+ initMonth = 8;
+ clockRotation = 135;
+ clockInitRotation = 135;
+ clockFinalRotation = clockInitRotation + 90;
+ color00 = (Color){196, 176, 49, 255}; // Spring Color
+ color01 = (Color){178, 163, 67, 255};
+ color02 = (Color){133, 143, 90, 255};
+ color03 = (Color){133, 156, 42, 255};
+ }
+
+ currentMonth = initMonth;
+
+ leftButton.x = 0;
+ leftButton.y = 200;
+ leftButton.width = GetScreenWidth()/2;
+ leftButton.height = GetScreenHeight();
+
+ rightButton.x = GetScreenWidth()/2;
+ rightButton.y = 200;
+ rightButton.width = GetScreenWidth()/2;
+ rightButton.height = GetScreenHeight();
+
+ powerButton.x = 0;
+ powerButton.y = 0;
+ powerButton.width = GetScreenWidth()/2;
+ powerButton.height = 200;
+
+ finalColor.r = GetRandomValue(0, 255);
+ finalColor.g = GetRandomValue(0, 255);
+ finalColor.b = GetRandomValue(0, 255);
+ finalColor.a = 255;
+
+ backBar.x = 20;
+ backBar.y = 22;
+ backBar.width = maxPower + 4;
+ backBar.height = 24;
+ powerBar.x = 22;
+ powerBar.y = 23;
+ powerBar.width = power;
+ powerBar.height = 22;
+
+ fireAnimation.x = gameplay_props_fire_spritesheet.x;
+ fireAnimation.y = gameplay_props_fire_spritesheet.y;
+ fireAnimation.width = gameplay_props_fire_spritesheet.width/4;
+ fireAnimation.height = gameplay_props_fire_spritesheet.height;
+
+ windAnimation.x = gameplay_props_whirlwind_spritesheet.x;
+ windAnimation.y = gameplay_props_whirlwind_spritesheet.y;
+ windAnimation.width = gameplay_props_whirlwind_spritesheet.width/4;
+ windAnimation.height = gameplay_props_whirlwind_spritesheet.height;
+
+ beeAnimation.x = gameplay_enemy_bee.x;
+ beeAnimation.y = gameplay_enemy_bee.y;
+ beeAnimation.width = gameplay_enemy_bee.width/5;
+ beeAnimation.height = gameplay_enemy_bee.height;
+
+ eagleAnimation.x = gameplay_enemy_eagle.x;
+ eagleAnimation.y = gameplay_enemy_eagle.y;
+ eagleAnimation.width = gameplay_enemy_eagle.width/2;
+ eagleAnimation.height = gameplay_enemy_eagle.height;
+
+ snakeAnimation.x = gameplay_enemy_snake.x;
+ snakeAnimation.y = gameplay_enemy_snake.y;
+ snakeAnimation.width = gameplay_enemy_snake.width/3;
+ snakeAnimation.height = gameplay_enemy_snake.height;
+
+ dingoAnimation.x = gameplay_enemy_dingo.x;
+ dingoAnimation.y = gameplay_enemy_dingo.y;
+ dingoAnimation.width = gameplay_enemy_dingo.width/3;
+ dingoAnimation.height = gameplay_enemy_dingo.height;
+
+ owlAnimation.x = gameplay_enemy_owl.x;
+ owlAnimation.y = gameplay_enemy_owl.y;
+ owlAnimation.width = gameplay_enemy_owl.width/3;
+ owlAnimation.height = gameplay_enemy_owl.height;
+
+ koalaAnimationIddle = gameplay_koala_idle;
+ koalaAnimationIddle.width = gameplay_koala_idle.width/3;
+ koalaAnimationJump = gameplay_koala_jump;
+ koalaAnimationFly = gameplay_koala_fly;
+ koalaAnimationFly.width = gameplay_koala_fly.width/2;
+ koalaAnimationTransform = gameplay_koala_transform;
+ koalaAnimationTransform.width = gameplay_koala_transform.width/2;
+
+ snowParticle.position = (Vector2){ 0, 0 };
+ snowParticle.active = false;
+ snowStormParticle.position = (Vector2){ 0, 0 };
+ snowStormParticle.active = false;
+ backSnowParticle.position = (Vector2){ 0, 0 };
+ backSnowParticle.active = false;
+ planetreeParticle.position = (Vector2){ 0, 0 };
+ planetreeParticle.active = false;
+ backPlanetreeParticle.position = (Vector2){ 0, 0 };
+ backPlanetreeParticle.active = false;
+ dandelionParticle.active = false;
+ dandelionBackParticle.position = (Vector2){ 0, 0};
+ flowerParticle.position = (Vector2){ 0, 0 };
+ flowerParticle.active = false;
+ backFlowerParticle.position = (Vector2){ 0, 0 };
+ backFlowerParticle.active = false;
+ rainParticle.position = (Vector2){ 0, 0 };
+ rainParticle.active = false;
+ rainStormParticle.position = (Vector2){ 0, 0 };
+ rainStormParticle.active = false;
+ backRainParticle.position = (Vector2){ 0, 0 };
+ backRainParticle.active = false;
+ rayParticles.position = (Vector2){ 0, 0 };
+ rayParticles.active = false;
+ backRayParticles.position = (Vector2){ 0, 0 };
+ backRayParticles.active = false;
+ speedFX.active = false;
+
+ clockPosition = (Vector2){GetScreenWidth(), 0};
+
+ for (int j = 0; j < MAX_PARTICLES; j++)
+ {
+ snowParticle.particles[j].active = false;
+ snowParticle.particles[j].position = (Vector2){ 0, 0 };
+ snowParticle.particles[j].size = (float)GetRandomValue(3, 9)/10;
+ snowParticle.particles[j].rotation = GetRandomValue(0, 360);
+ snowParticle.particles[j].color = WHITE;
+ snowParticle.particles[j].alpha = 1.0f;
+
+ backSnowParticle.particles[j].active = false;
+ backSnowParticle.particles[j].position = (Vector2){ 0, 0 };
+ backSnowParticle.particles[j].size = (float)GetRandomValue(2, 8)/10;
+ backSnowParticle.particles[j].rotation = GetRandomValue(0, 360);
+ backSnowParticle.particles[j].color = WHITE;
+ backSnowParticle.particles[j].alpha = 0.7f;
+
+ planetreeParticle.particles[j].active = false;
+ planetreeParticle.particles[j].position = (Vector2){ 0, 0 };
+ planetreeParticle.particles[j].size = (float)GetRandomValue(3, 9)/10;
+ planetreeParticle.particles[j].rotation = GetRandomValue(0, 360);
+ planetreeParticle.particles[j].color = WHITE;
+ planetreeParticle.particles[j].alpha = 1.0f;
+
+ backPlanetreeParticle.particles[j].active = false;
+ backPlanetreeParticle.particles[j].position = (Vector2){ 0, 0 };
+ backPlanetreeParticle.particles[j].size = (float)GetRandomValue(2, 8)/10;
+ backPlanetreeParticle.particles[j].rotation = GetRandomValue(0, 360);
+ backPlanetreeParticle.particles[j].color = WHITE;
+ backPlanetreeParticle.particles[j].alpha = 0.7f;
+
+ dandelionParticle.particles[j].active = false;
+ dandelionParticle.particles[j].position = (Vector2){ 0, 0 };
+ dandelionParticle.particles[j].size = (float)GetRandomValue(3, 9)/10;
+ dandelionParticle.particles[j].rotation = 0;
+ dandelionParticle.particles[j].color = WHITE;
+ dandelionParticle.particles[j].alpha = 1;
+ dandelionParticle.particles[j].rotPhy = GetRandomValue(0 , 180);
+
+ dandelionBackParticle.particles[j].active = false;
+ dandelionBackParticle.particles[j].position = (Vector2){ 0, 0 };
+ dandelionBackParticle.particles[j].size = (float)GetRandomValue(2, 8)/10;
+ dandelionBackParticle.particles[j].rotation = 0;
+ dandelionBackParticle.particles[j].color = WHITE;
+ dandelionBackParticle.particles[j].alpha = 0.7f;
+ dandelionBackParticle.particles[j].rotPhy = GetRandomValue(0 , 180);
+
+ flowerParticle.particles[j].active = false;
+ flowerParticle.particles[j].position = (Vector2){ 0, 0 };
+ flowerParticle.particles[j].size = (float)GetRandomValue(3, 9)/10;
+ flowerParticle.particles[j].rotation = GetRandomValue(0, 360);
+ flowerParticle.particles[j].color = WHITE;
+ flowerParticle.particles[j].alpha = 1.0f;
+
+ backFlowerParticle.particles[j].active = false;
+ backFlowerParticle.particles[j].position = (Vector2){ 0, 0 };
+ backFlowerParticle.particles[j].size = (float)GetRandomValue(2, 8)/10;
+ backFlowerParticle.particles[j].rotation = GetRandomValue(0, 360);
+ backFlowerParticle.particles[j].color = WHITE;
+ backFlowerParticle.particles[j].alpha = 0.7f;
+
+ rainParticle.particles[j].active = false;
+ rainParticle.particles[j].position = (Vector2){ 0, 0 };
+ rainParticle.particles[j].size = (float)GetRandomValue(3, 9)/10;
+ rainParticle.particles[j].rotation = -20;
+ rainParticle.particles[j].color = WHITE;
+ rainParticle.particles[j].alpha = 1.0f;
+
+ backRainParticle.particles[j].active = false;
+ backRainParticle.particles[j].position = (Vector2){ 0, 0 };
+ backRainParticle.particles[j].size = (float)GetRandomValue(2, 8)/10;
+ backRainParticle.particles[j].rotation = -20;
+ backRainParticle.particles[j].color = WHITE;
+ backRainParticle.particles[j].alpha = 0.7f;
+
+ }
+
+ for (int j = 0; j < MAX_PARTICLES_SPEED; j++)
+ {
+ speedFX.particle[j].position = (Vector2){ 0, 0 };
+ speedFX.particle[j].color = WHITE;
+ speedFX.particle[j].alpha = 1.0f;
+ speedFX.particle[j].size = (Vector2){GetScreenWidth(), GetRandomValue(10, 50)/10};
+ speedFX.particle[j].rotation = 0.0f;
+ speedFX.particle[j].active = false;
+ }
+
+ for (int j = 0; j < MAX_PARTICLES_STORM; j++)
+ {
+ rainStormParticle.particles[j].active = false;
+ rainStormParticle.particles[j].position = (Vector2){ 0, 0 };
+ rainStormParticle.particles[j].size = (float)GetRandomValue(3, 9)/10;
+ rainStormParticle.particles[j].rotation = -40;
+ rainStormParticle.particles[j].color = WHITE;
+ rainStormParticle.particles[j].alpha = 1.0f;
+ }
+
+ for (int j = 0; j < MAX_PARTICLES_STORM; j++)
+ {
+ snowStormParticle.particles[j].active = false;
+ snowStormParticle.particles[j].position = (Vector2){ 0, 0 };
+ snowStormParticle.particles[j].size = (float)GetRandomValue(2, 8)/10;
+ snowStormParticle.particles[j].rotation = 40;
+ snowStormParticle.particles[j].color = WHITE;
+ snowStormParticle.particles[j].alpha = 1.0f;
+ }
+
+ for (int i = 0; i < MAX_PARTICLES_RAY; i++)
+ {
+ rayParticles.particles[i].position = (Vector2){ 0, 0 };
+ rayParticles.particles[i].color.r = 255;
+ rayParticles.particles[i].color.g = 255;
+ rayParticles.particles[i].color.b = 182;
+ rayParticles.particles[i].color.a = 255;
+ rayParticles.particles[i].alpha = 0.0f;
+ rayParticles.particles[i].size = (float)(GetRandomValue(30, 70)/10);
+ rayParticles.particles[i].rotation = 0.0f;
+ rayParticles.particles[i].active = false;
+ rayParticles.particles[i].fading = false;
+ rayParticles.particles[i].delayCounter = 0;
+
+ backRayParticles.particles[i].position = (Vector2){ 0, 0 };
+ backRayParticles.particles[i].color.r = 255;
+ backRayParticles.particles[i].color.g = 255;
+ backRayParticles.particles[i].color.b = 182;
+ backRayParticles.particles[i].color.a = 255;
+ backRayParticles.particles[i].alpha = 0.0f;
+ backRayParticles.particles[i].size = (float)(GetRandomValue(10, 20)/10);
+ backRayParticles.particles[i].rotation = 0.0f;
+ backRayParticles.particles[i].active = false;
+ backRayParticles.particles[i].fading = false;
+ backRayParticles.particles[i].delayCounter = 0;
+ }
+
+ for (int i = 0; i < MAX_KILLS; i++) killHistory[i] = 0;
+
+ for (int i = 0; i < MAX_BAMBOO; i++)
+ {
+ bamboo[i].x = 150 + 200*i;
+ bamboo[i].y = 0;
+ bamboo[i].width = 50;
+ bamboo[i].height = GetScreenHeight();
+ if(i > 5) bambooActive[i] = false;
+ else bambooActive[i] = true;
+ }
+
+ for (int i = 0; i < MAX_FIRE; i++)
+ {
+ fire[i].x = -200;
+ fire[i].y = GetScreenHeight() - 30;
+ fire[i].width = 30;
+ fire[i].height = 720;
+ fireActive[i] = false;
+ onFire[i] = false;
+ fireCounter[i] = 0;
+ }
+
+ for (int i = 0; i < MAX_ICE; i++)
+ {
+ ice[i].x = -100;
+ ice[i].y = 0;
+ ice[i].width = 10;
+ ice[i].height = GetScreenHeight();
+ iceActive[i] = false;
+ }
+
+ for (int i = 0; i < MAX_RESIN; i++)
+ {
+ resin[i].x = -100;
+ resin[i].y = 0;
+ resin[i].width = 32;
+ resin[i].height = 50;
+ resinActive[i] = false;
+ }
+
+ for (int i = 0; i < MAX_WIND; i++)
+ {
+ wind[i].x = -100;
+ wind[i].y = 0;
+ wind[i].width = 70;
+ wind[i].height = 100;
+ windActive[i] = false;
+ }
+
+ for (int i = 0; i < MAX_ENEMIES; i++)
+ {
+ snake[i].x = 0;
+ snake[i].y = 0;
+ snake[i].width = 50;
+ snake[i].height = 60;
+ snakeActive[i] = false;
+ isHitSnake[i] = false;
+
+ dingo[i].x = -100;
+ dingo[i].y = 0;
+ dingo[i].width = 64;
+ dingo[i].height = 90;
+ dingoActive[i] = false;
+ isHitDingo[i] = false;
+
+ owl[i].x = -100;
+ owl[i].y = 0;
+ owl[i].width = 40;
+ owl[i].height = 60;
+ owlActive[i] = false;
+ branchActive[i] = false;
+ isHitOwl[i] = false;
+
+ branchPos[i].x = owl[i].x;
+ branchPos[i].y = owl[i].y;
+
+ enemyHit[i].position = (Vector2){ GetRandomValue(-20, 20), GetRandomValue(-20, 20) };
+ enemyHit[i].speed = (Vector2){ (float)GetRandomValue(-500, 500)/100, (float)GetRandomValue(-500, 500)/100 };
+ enemyHit[i].size = (float)GetRandomValue(1, 45)/30;
+ enemyHit[i].rotation = GetRandomValue(0, 360);
+ enemyHit[i].color = RED;
+ enemyHit[i].alpha = 1.0f;
+ enemyHit[i].active = false;
+
+ popupScore[i].position = (Vector2){ GetRandomValue(-20, 20), GetRandomValue(-20, 20) };
+ popupScore[i].scale = (float)GetRandomValue(1, 45)/30;
+ popupScore[i].alpha = 1.0f;
+ popupScore[i].active = false;
+ }
+
+ for (int i = 0; i < MAX_LEAVES; i++)
+ {
+ leaf[i].x = 0;
+ leaf[i].y = 0;
+ leaf[i].width = 30;
+ leaf[i].height = 30;
+ leafActive[i] = false;
+ leafType[i] = -1;
+
+ leafParticles[i].position = (Vector2){ 0, 0 };
+ leafParticles[i].active = false;
+
+ popupLeaves[i].position = (Vector2){ GetRandomValue(-20, 20), GetRandomValue(-20, 20) };
+ popupLeaves[i].scale = (float)GetRandomValue(1, 45)/30;
+ popupLeaves[i].alpha = 1.0f;
+ popupLeaves[i].score = 0;
+ popupLeaves[i].active = false;
+
+ for (int j = 0; j < 32; j++)
+ {
+
+ leafParticles[i].particles[j].active = false;
+ leafParticles[i].particles[j].position = (Vector2){ GetRandomValue(-20, 20), GetRandomValue(-20, 20) };
+ leafParticles[i].particles[j].speed = (Vector2){ (float)GetRandomValue(-500, 500)/100, (float)GetRandomValue(-500, 500)/100 };
+ leafParticles[i].particles[j].size = (float)GetRandomValue(3, 10)/5;
+ leafParticles[i].particles[j].rotation = GetRandomValue(0, 360);
+ leafParticles[i].particles[j].color = WHITE;
+ leafParticles[i].particles[j].alpha = 1.0f;
+ }
+ }
+
+ player.x = GetScreenWidth()*0.26f;
+ player.y = 100;
+ player.width = 35;
+ player.height = 60;
+
+ bee.x = -200;
+ bee.y = 0;
+ bee.width = 50;
+ bee.height = 32;
+ beeActive = false;
+
+ popupBee.position = (Vector2){ GetRandomValue(-20, 20), GetRandomValue(-20, 20) };
+ popupBee.scale = (float)GetRandomValue(1, 45)/30;
+ popupBee.alpha = 1.0f;
+ popupBee.active = false;
+
+ eagle.x = -128;
+ eagle.y = 0;
+ eagle.width = 200;
+ eagle.height = 80;
+ eagleActive = false;
+
+ popupEagle.position = (Vector2){ GetRandomValue(-20, 20), GetRandomValue(-20, 20) };
+ popupEagle.scale = (float)GetRandomValue(1, 45)/30;
+ popupEagle.alpha = 1.0f;
+ popupEagle.active = false;
+
+ counterColor.r = 255;
+ counterColor.g = 224;
+ counterColor.b = 185;
+ counterColor.a = 255;
+
+ zero.x = 0;
+ zero.y = 0;
+
+ firePos.x = -200;
+ firePos.y = 0;
+
+ textSize = MeasureTextEx(font, "3", font.size*5, 2);
+}
diff --git a/games/koala_seasons/screens/screen_logo.c b/games/koala_seasons/screens/screen_logo.c
new file mode 100644
index 00000000..a3035b30
--- /dev/null
+++ b/games/koala_seasons/screens/screen_logo.c
@@ -0,0 +1,227 @@
+/**********************************************************************************************
+*
+* raylib - Standard Game template
+*
+* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
+*
+* Copyright (c) 2014 Ramon Santamaria (Ray San - [email protected])
+*
+* 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;
+} \ No newline at end of file
diff --git a/games/koala_seasons/screens/screen_title.c b/games/koala_seasons/screens/screen_title.c
new file mode 100644
index 00000000..ace961e1
--- /dev/null
+++ b/games/koala_seasons/screens/screen_title.c
@@ -0,0 +1,1069 @@
+/**********************************************************************************************
+*
+* raylib - Koala Seasons game
+*
+* Title 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 <math.h>
+
+#include "atlas01.h"
+#include "atlas02.h"
+
+#define MAX_DURATION 120
+#define MAX_particle 128
+
+//----------------------------------------------------------------------------------
+// Global Variables Definition (local to this module)
+//----------------------------------------------------------------------------------
+
+typedef struct {
+ Vector2 position;
+ Vector2 speed;
+ float rotation;
+ float size;
+ Color color;
+ float alpha;
+ float rotPhy;
+ bool active;
+} Particle;
+
+typedef struct {
+ Vector2 position;
+ Color color;
+ float alpha;
+ float size;
+ float rotation;
+ bool active; // NOTE: Use it to activate/deactive particle
+ bool fading;
+ float delayCounter;
+} RayParticleTitle;
+
+typedef struct {
+ Vector2 position;
+ bool active;
+ int spawnTime;
+ int maxTime;
+ Particle particle[1024];
+} Stormparticleystem;
+
+typedef struct {
+ Vector2 position;
+ bool active;
+ int spawnTime;
+ int maxTime;
+ Particle particle[MAX_particle];
+} particleystemTitle;
+
+typedef struct {
+ Vector2 position;
+ bool active;
+ int spawnTime;
+ int maxTime;
+ RayParticleTitle particle[20];
+} RayparticleystemTitle;
+
+// Title screen global variables
+static int framesCounter;
+static int finishScreen;
+static int globalFrameCounter;
+static int currentFrame;
+static int thisFrame;
+static int parallaxBackOffset;
+static int parallaxFrontOffset;
+
+static float currentValue1;
+static float currentValue2;
+static float initValue1;
+static float initValue2;
+static float finishValue1;
+static float finishValue2;
+static float duration;
+
+static Vector2 fontSize;
+
+static bool soundActive;
+static bool musicActive;
+
+static Rectangle koalaMenu;
+
+static Rectangle bamboo[5];
+static Rectangle player = {0, 0, 0, 0};
+static Rectangle soundButton;
+static Rectangle speakerButton;
+
+static Color color00, color01, color02, color03;
+
+static particleystemTitle snowParticle;
+static particleystemTitle backSnowParticle;
+static particleystemTitle dandelionParticle;
+static particleystemTitle dandelionBackParticle;
+static particleystemTitle planetreeParticle;
+static particleystemTitle backPlanetreeParticle;
+static particleystemTitle flowerParticle;
+static particleystemTitle backFlowerParticle;
+static particleystemTitle rainParticle;
+static particleystemTitle backRainParticle;
+static RayparticleystemTitle rayparticle;
+static RayparticleystemTitle backRayparticle;
+static Stormparticleystem rainStormParticle;
+static Stormparticleystem snowStormParticle;
+
+const char pressToPlay[16] = "Press to play";
+
+//----------------------------------------------------------------------------------
+// Title Screen Functions Definition
+//----------------------------------------------------------------------------------
+static void DrawParallaxFront(void);
+static void DrawParallaxMiddle(void);
+static void DrawParallaxBack(void);
+
+static float BounceEaseOut(float t,float b , float c, float d);
+
+// Title Screen Initialization logic
+void InitTitleScreen(void)
+{
+ framesCounter = 0;
+ finishScreen = 0;
+ initValue1 = -100;
+ finishValue1 = 100;
+ initValue2 = 700;
+ finishValue2 = finishValue1 + 220;
+ duration = MAX_DURATION;
+ initSeason = GetRandomValue(0, 3);
+ soundActive = true;
+ musicActive = true;
+
+ parallaxBackOffset = GetRandomValue(10, 100);
+ parallaxFrontOffset = GetRandomValue(100, 200);
+
+ rainChance = GetRandomValue(0, 100);
+
+ snowParticle.position = (Vector2){ 0, 0 };
+ snowParticle.active = false;
+ backSnowParticle.position = (Vector2){ 0, 0 };
+ backSnowParticle.active = false;
+ planetreeParticle.position = (Vector2){ 0, 0 };
+ planetreeParticle.active = false;
+ backPlanetreeParticle.position = (Vector2){ 0, 0 };
+ backPlanetreeParticle.active = false;
+ dandelionParticle.active = false;
+ dandelionBackParticle.position = (Vector2){ 0, 0};
+ flowerParticle.position = (Vector2){ 0, 0 };
+ flowerParticle.active = false;
+ backFlowerParticle.position = (Vector2){ 0, 0 };
+ backFlowerParticle.active = false;
+ rayparticle.position = (Vector2){ 0, 0 };
+ rayparticle.active = false;
+ backRayparticle.position = (Vector2){ 0, 0 };
+ backRayparticle.active = false;
+ rainStormParticle.position = (Vector2){ 0, 0 };
+ rainStormParticle.active = false;
+ snowStormParticle.position = (Vector2){ 0, 0 };
+ snowStormParticle.active = false;
+
+ soundButton = (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.7, title_music_on.width, title_music_on.height };
+ speakerButton = (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.85, title_speaker_on.width, title_speaker_on.height };
+
+ for (int j = 0; j < MAX_particle; j++)
+ {
+ snowParticle.particle[j].active = false;
+ snowParticle.particle[j].position = (Vector2){ 0, 0 };
+ snowParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
+ snowParticle.particle[j].rotation = GetRandomValue(0, 360);
+ snowParticle.particle[j].color = WHITE;
+ snowParticle.particle[j].alpha = 1.0f;
+
+ backSnowParticle.particle[j].active = false;
+ backSnowParticle.particle[j].position = (Vector2){ 0, 0 };
+ backSnowParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
+ backSnowParticle.particle[j].rotation = GetRandomValue(0, 360);
+ backSnowParticle.particle[j].color = WHITE;
+ backSnowParticle.particle[j].alpha = 0.7f;
+
+ planetreeParticle.particle[j].active = false;
+ planetreeParticle.particle[j].position = (Vector2){ 0, 0 };
+ planetreeParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
+ planetreeParticle.particle[j].rotation = GetRandomValue(0, 360);
+ planetreeParticle.particle[j].color = WHITE;
+ planetreeParticle.particle[j].alpha = 1.0f;
+
+ backPlanetreeParticle.particle[j].active = false;
+ backPlanetreeParticle.particle[j].position = (Vector2){ 0, 0 };
+ backPlanetreeParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
+ backPlanetreeParticle.particle[j].rotation = GetRandomValue(0, 360);
+ backPlanetreeParticle.particle[j].color = WHITE;
+ backPlanetreeParticle.particle[j].alpha = 0.7f;
+
+ dandelionParticle.particle[j].active = false;
+ dandelionParticle.particle[j].position = (Vector2){ 0, 0 };
+ dandelionParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
+ dandelionParticle.particle[j].rotation = 0;
+ dandelionParticle.particle[j].color = WHITE;
+ dandelionParticle.particle[j].alpha = 1;
+ dandelionParticle.particle[j].rotPhy = GetRandomValue(0 , 180);
+
+ dandelionBackParticle.particle[j].active = false;
+ dandelionBackParticle.particle[j].position = (Vector2){ 0, 0 };
+ dandelionBackParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
+ dandelionBackParticle.particle[j].rotation = 0;
+ dandelionBackParticle.particle[j].color = WHITE;
+ dandelionBackParticle.particle[j].alpha = 0.7f;
+ dandelionBackParticle.particle[j].rotPhy = GetRandomValue(0 , 180);
+
+ flowerParticle.particle[j].active = false;
+ flowerParticle.particle[j].position = (Vector2){ 0, 0 };
+ flowerParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
+ flowerParticle.particle[j].rotation = GetRandomValue(0, 360);
+ flowerParticle.particle[j].color = WHITE;
+ flowerParticle.particle[j].alpha = 1.0f;
+
+ backFlowerParticle.particle[j].active = false;
+ backFlowerParticle.particle[j].position = (Vector2){ 0, 0 };
+ backFlowerParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
+ backFlowerParticle.particle[j].rotation = GetRandomValue(0, 360);
+ backFlowerParticle.particle[j].color = WHITE;
+ backFlowerParticle.particle[j].alpha = 0.7f;
+
+ rainParticle.particle[j].active = false;
+ rainParticle.particle[j].position = (Vector2){ 0, 0 };
+ rainParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
+ rainParticle.particle[j].rotation = -20;
+ rainParticle.particle[j].color = WHITE;
+ rainParticle.particle[j].alpha = 1.0f;
+
+ backRainParticle.particle[j].active = false;
+ backRainParticle.particle[j].position = (Vector2){ 0, 0 };
+ backRainParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
+ backRainParticle.particle[j].rotation = -20;
+ backRainParticle.particle[j].color = WHITE;
+ backRainParticle.particle[j].alpha = 0.7f;
+ }
+
+ for (int j = 0; j < 1024; j++)
+ {
+ rainStormParticle.particle[j].active = false;
+ rainStormParticle.particle[j].position = (Vector2){ 0, 0 };
+ rainStormParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
+ rainStormParticle.particle[j].rotation = -40;
+ rainStormParticle.particle[j].color = WHITE;
+ rainStormParticle.particle[j].alpha = 1.0f;
+ }
+
+ for (int j = 0; j < 256; j++)
+ {
+ snowStormParticle.particle[j].active = false;
+ snowStormParticle.particle[j].position = (Vector2){ 0, 0 };
+ snowStormParticle.particle[j].size = (float)GetRandomValue(4, 8)/10;
+ snowStormParticle.particle[j].rotation = 40;
+ snowStormParticle.particle[j].color = WHITE;
+ snowStormParticle.particle[j].alpha = 1.0f;
+ }
+
+ for (int i = 0; i < 20; i++)
+ {
+ rayparticle.particle[i].position = (Vector2){ 0, 0 };
+ rayparticle.particle[i].color.r = 255;
+ rayparticle.particle[i].color.g = 255;
+ rayparticle.particle[i].color.b = 182;
+ rayparticle.particle[i].color.a = 255;
+ rayparticle.particle[i].alpha = 0.0f;
+ rayparticle.particle[i].size = (float)GetRandomValue(15, 20)/10;
+ rayparticle.particle[i].rotation = 0.0f;
+ rayparticle.particle[i].active = false;
+ rayparticle.particle[i].fading = false;
+ rayparticle.particle[i].delayCounter = 0;
+
+ backRayparticle.particle[i].position = (Vector2){ 0, 0 };
+ backRayparticle.particle[i].color.r = 255;
+ backRayparticle.particle[i].color.g = 255;
+ backRayparticle.particle[i].color.b = 182;
+ backRayparticle.particle[i].color.a = 255;
+ backRayparticle.particle[i].alpha = 0.0f;
+ backRayparticle.particle[i].size = (float)GetRandomValue(5, 10)/10;
+ backRayparticle.particle[i].rotation = 0.0f;
+ backRayparticle.particle[i].active = false;
+ backRayparticle.particle[i].fading = false;
+ backRayparticle.particle[i].delayCounter = 0;
+ }
+
+ for (int i = 0; i < 5; i++)
+ {
+ bamboo[i].x = 150 + 200*i;
+ bamboo[i].y = 0;
+ bamboo[i].width = 30;
+ bamboo[i].height = GetScreenHeight();
+ }
+
+ player.x = 350;
+ player.y = 100;
+ player.width = 35;
+ player.height = 60;
+
+ koalaMenu.x = gameplay_koala_menu.x;
+ koalaMenu.y = gameplay_koala_menu.y;
+ koalaMenu.width = gameplay_koala_menu.width/2;
+ koalaMenu.height = gameplay_koala_menu.height;
+
+ fontSize = MeasureTextEx(font, "PRESS TO PLAY", font.size, 2);
+}
+
+// Title Screen Update logic
+void UpdateTitleScreen(void)
+{
+ framesCounter += 1*TIME_FACTOR;
+ globalFrameCounter += 1*TIME_FACTOR;
+
+ if (framesCounter < duration)
+ {
+ currentValue1 = BounceEaseOut((float) framesCounter, initValue1, (finishValue1 - initValue1), duration);
+ currentValue2 = BounceEaseOut((float) framesCounter, initValue2, (finishValue2 - initValue2), duration);
+ }
+
+ thisFrame += 1*TIME_FACTOR;
+
+ if (thisFrame >= 40)
+ {
+ currentFrame++;
+ thisFrame = 0;
+ }
+
+ if (currentFrame > 1) currentFrame = 0;
+
+ koalaMenu.x = gameplay_koala_menu.x + koalaMenu.width*currentFrame;
+
+ if (initSeason == 0)
+ {
+ dandelionParticle.active = true;
+ dandelionBackParticle.active = true;
+ rayparticle.active = true;
+ backRayparticle.active = true;
+
+ rainParticle.active = false;
+ rainStormParticle.active = false;
+ backRainParticle.active = false;
+
+ color00 = (Color){129, 172, 86, 255}; // Summer Color
+ color01 = (Color){145, 165, 125, 255};
+ color02 = (Color){161, 130, 73, 255};
+ color03 = (Color){198, 103, 51, 255};
+ }
+ else if (initSeason == 1)
+ {
+ if (rainChance > 40)
+ {
+ planetreeParticle.active = true;
+ backPlanetreeParticle.active = true;
+ rainParticle.active = false;
+ backRainParticle.active = false;
+ }
+ else if (rainChance <= 40 && rainChance > 15)
+ {
+ rainStormParticle.active = true;
+ backRainParticle.active = false;
+ }
+ else if (rainChance <= 15)
+ {
+ rainStormParticle.active = true;
+ backRainParticle.active = false;
+ }
+
+ color00 = (Color){242, 113, 62, 255}; // Fall Color
+ color01 = (Color){190, 135, 114, 255};
+ color02 = (Color){144, 130, 101, 255};
+ color03 = (Color){214, 133, 58, 255};
+
+ }
+ else if (initSeason == 2)
+ {
+
+ if (rainChance > 40)
+ {
+ snowParticle.active = true;
+ backSnowParticle.active = true;
+ }
+ else
+ {
+ snowStormParticle.active = true;
+ backSnowParticle.active = true;
+ }
+
+ rainParticle.active = false;
+ rainStormParticle.active = false;
+ backRainParticle.active = false;
+
+ color00 = (Color){130, 130, 181, 255}; // Winter Color
+ color01 = (Color){145, 145, 166, 255};
+ color02 = (Color){104, 142, 144, 255};
+ color03 = (Color){57, 140, 173, 255};
+ }
+ else if (initSeason == 3)
+ {
+ flowerParticle.active = true;
+ backFlowerParticle.active = true;
+
+ rainParticle.active = false;
+ rainStormParticle.active = false;
+ backRainParticle.active = false;
+
+ color00 = (Color){196, 176, 49, 255}; // Spring Color
+ color01 = (Color){178, 163, 67, 255};
+ color02 = (Color){133, 143, 90, 255};
+ color03 = (Color){133, 156, 42, 255};
+ }
+
+ // Snow Particle
+ if (snowParticle.active)
+ {
+ snowParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_particle; i++)
+ {
+ if (!snowParticle.particle[i].active && snowParticle.spawnTime >= snowParticle.maxTime)
+ {
+ snowParticle.particle[i].active = true;
+ snowParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ snowParticle.spawnTime = 0;
+ snowParticle.maxTime = GetRandomValue (5, 20);
+ }
+ }
+ }
+
+ if (backSnowParticle.active)
+ {
+ backSnowParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_particle; i++)
+ {
+ if (!backSnowParticle.particle[i].active && backSnowParticle.spawnTime >= backSnowParticle.maxTime)
+ {
+ backSnowParticle.particle[i].active = true;
+ backSnowParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ backSnowParticle.spawnTime = 0;
+ backSnowParticle.maxTime = GetRandomValue (3, 10);
+ }
+ }
+ }
+
+ // Autumn leaves particle
+ if (planetreeParticle.active)
+ {
+ planetreeParticle.spawnTime += 1*TIME_FACTOR;
+ backPlanetreeParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_particle; i++)
+ {
+ if (!planetreeParticle.particle[i].active && planetreeParticle.spawnTime >= planetreeParticle.maxTime)
+ {
+ planetreeParticle.particle[i].active = true;
+ planetreeParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ planetreeParticle.spawnTime = 0;
+ planetreeParticle.maxTime = GetRandomValue (5, 20);
+ }
+
+ if (!backPlanetreeParticle.particle[i].active && backPlanetreeParticle.spawnTime >= backPlanetreeParticle.maxTime)
+ {
+ backPlanetreeParticle.particle[i].active = true;
+ backPlanetreeParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ backPlanetreeParticle.spawnTime = 0;
+ backPlanetreeParticle.maxTime = GetRandomValue (3, 10);
+ }
+ }
+ }
+
+ // Dandelion particle
+ if (dandelionParticle.active)
+ {
+ dandelionParticle.spawnTime += 1*TIME_FACTOR;
+ dandelionBackParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_particle; i++)
+ {
+ if (!dandelionParticle.particle[i].active && dandelionParticle.spawnTime >= dandelionParticle.maxTime)
+ {
+ dandelionParticle.particle[i].active = true;
+ dandelionParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ dandelionParticle.spawnTime = 0;
+ dandelionParticle.maxTime = GetRandomValue (5, 20);
+ }
+
+ if (!dandelionBackParticle.particle[i].active && dandelionBackParticle.spawnTime >= dandelionBackParticle.maxTime)
+ {
+ dandelionBackParticle.particle[i].active = true;
+ dandelionBackParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ dandelionBackParticle.spawnTime = 0;
+ dandelionBackParticle.maxTime = GetRandomValue (3, 10);
+ }
+ }
+ }
+
+ // Flower Particle
+ if (flowerParticle.active)
+ {
+
+ flowerParticle.spawnTime += 1*TIME_FACTOR;
+ backFlowerParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_particle; i++)
+ {
+ if (!flowerParticle.particle[i].active && flowerParticle.spawnTime >= flowerParticle.maxTime)
+ {
+ flowerParticle.particle[i].active = true;
+ flowerParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ flowerParticle.spawnTime = 0;
+ flowerParticle.maxTime = GetRandomValue (5, 20);
+ }
+
+ if (!backFlowerParticle.particle[i].active && backFlowerParticle.spawnTime >= backFlowerParticle.maxTime)
+ {
+ backFlowerParticle.particle[i].active = true;
+ backFlowerParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ backFlowerParticle.spawnTime = 0;
+ backFlowerParticle.maxTime = GetRandomValue (3, 10);
+ }
+ }
+ }
+
+ // Storm particle
+ if (rainStormParticle.active)
+ {
+
+ rainStormParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < 1024; i++)
+ {
+ if (!rainStormParticle.particle[i].active && rainStormParticle.spawnTime >= rainStormParticle.maxTime)
+ {
+ for (int j = 0; j < 16; j++)
+ {
+ rainStormParticle.particle[i+j].active = true;
+ rainStormParticle.particle[i+j].position = (Vector2){GetRandomValue(100, GetScreenWidth() + 1000), GetRandomValue(-10,-20)};
+ }
+
+ rainStormParticle.spawnTime = 0;
+ rainStormParticle.maxTime = 4;
+ }
+ }
+ }
+
+ // Snow Storm particle
+ if (snowStormParticle.active)
+ {
+ snowStormParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < 256; i++)
+ {
+ if (!snowStormParticle.particle[i].active && snowStormParticle.spawnTime >= snowStormParticle.maxTime)
+ {
+ snowStormParticle.particle[i].active = true;
+ snowStormParticle.particle[i].position = (Vector2){GetRandomValue(100, GetScreenWidth() + 800), -10};
+ snowStormParticle.spawnTime = 0;
+ snowStormParticle.maxTime = GetRandomValue (1, 2);
+ }
+ }
+ }
+
+ if (rayparticle.active)
+ {
+ rayparticle.spawnTime += 1*TIME_FACTOR;
+ backRayparticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < 20; i++)
+ {
+ if (!rayparticle.particle[i].active && rayparticle.spawnTime >= rayparticle.maxTime)
+ {
+ //printf("PARTICLEEES");
+ rayparticle.particle[i].active = true;
+ rayparticle.particle[i].alpha = 0.0f;
+ rayparticle.particle[i].size = (float)(GetRandomValue(10, 20)/10);
+ rayparticle.particle[i].position = (Vector2){GetRandomValue(300, GetScreenWidth() + 200), 0};
+ rayparticle.particle[i].rotation = -35;
+ rayparticle.spawnTime = 0;
+ rayparticle.particle[i].delayCounter = 0;
+ rayparticle.maxTime = GetRandomValue (20, 50);
+ }
+
+ if (!backRayparticle.particle[i].active && backRayparticle.spawnTime >= backRayparticle.maxTime)
+ {
+ backRayparticle.particle[i].active = true;
+ backRayparticle.particle[i].alpha = 0.0f;
+ backRayparticle.particle[i].size = (float)(GetRandomValue(5, 15)/10);
+ backRayparticle.particle[i].position = (Vector2){GetRandomValue(300, GetScreenWidth() + 200), 0};
+ backRayparticle.particle[i].rotation = -35;
+ backRayparticle.spawnTime = 0;
+ backRayparticle.particle[i].delayCounter = 0;
+ backRayparticle.maxTime = GetRandomValue (20, 50);
+ }
+ }
+ }
+
+ if (rainParticle.active)
+ {
+ rainParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_particle; i++)
+ {
+ if (!rainParticle.particle[i].active && rainParticle.spawnTime >= rainParticle.maxTime)
+ {
+ rainParticle.particle[i].active = true;
+ rainParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ rainParticle.spawnTime = 0;
+ rainParticle.maxTime = GetRandomValue (1, 8);
+ }
+ }
+ }
+
+ if (backRainParticle.active)
+ {
+ backRainParticle.spawnTime += 1*TIME_FACTOR;
+
+ for (int i = 0; i < MAX_particle; i++)
+ {
+
+ if (!backRainParticle.particle[i].active && backRainParticle.spawnTime >= backRainParticle.maxTime)
+ {
+ backRainParticle.particle[i].active = true;
+ backRainParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
+ backRainParticle.spawnTime = 0;
+ backRainParticle.maxTime = GetRandomValue (3, 10);
+ }
+ }
+ }
+
+ // particle Logic
+ for (int i = 0; i < MAX_particle; i++)
+ {
+ if (snowParticle.particle[i].active)
+ {
+ snowParticle.particle[i].position.y += 2*TIME_FACTOR;
+ snowParticle.particle[i].position.x -= 2*TIME_FACTOR;
+ snowParticle.particle[i].rotation += 0.5*TIME_FACTOR;
+ if (snowParticle.particle[i].position.y >= GetScreenHeight()) snowParticle.particle[i].active = false;
+ }
+
+ if (backSnowParticle.particle[i].active)
+ {
+ backSnowParticle.particle[i].position.y += 4*TIME_FACTOR;
+ backSnowParticle.particle[i].position.x -= 3*TIME_FACTOR;
+ backSnowParticle.particle[i].rotation += 0.5*TIME_FACTOR;
+ if (backSnowParticle.particle[i].position.y >= GetScreenHeight()) backSnowParticle.particle[i].active = false;
+ }
+
+ if (planetreeParticle.particle[i].active)
+ {
+ planetreeParticle.particle[i].position.y += 4*TIME_FACTOR;
+ planetreeParticle.particle[i].position.x -= 2*TIME_FACTOR;
+ planetreeParticle.particle[i].rotation += 0.5*TIME_FACTOR;
+ if (planetreeParticle.particle[i].position.y >= GetScreenHeight()) planetreeParticle.particle[i].active = false;
+ }
+
+ if (backPlanetreeParticle.particle[i].active)
+ {
+ backPlanetreeParticle.particle[i].position.y += 4*TIME_FACTOR;
+ backPlanetreeParticle.particle[i].position.x -= 3*TIME_FACTOR;
+ backPlanetreeParticle.particle[i].rotation += 0.5*TIME_FACTOR;
+ if (backPlanetreeParticle.particle[i].position.y >= GetScreenHeight()) backPlanetreeParticle.particle[i].active = false;
+ }
+
+ if (dandelionParticle.particle[i].active)
+ {
+ dandelionParticle.particle[i].position.y += 2.5*TIME_FACTOR;
+ dandelionParticle.particle[i].position.x -= 2*TIME_FACTOR;
+ dandelionParticle.particle[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
+ if (dandelionParticle.particle[i].position.y >= GetScreenHeight()) dandelionParticle.particle[i].active = false;
+ }
+
+ if (dandelionBackParticle.particle[i].active)
+ {
+ dandelionBackParticle.particle[i].position.y += 2*TIME_FACTOR;
+ dandelionBackParticle.particle[i].position.x -= 3*TIME_FACTOR;
+ dandelionBackParticle.particle[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
+ if (dandelionBackParticle.particle[i].position.y >= GetScreenHeight()) dandelionBackParticle.particle[i].active = false;
+ }
+
+ if (flowerParticle.particle[i].active)
+ {
+ flowerParticle.particle[i].position.y += 2.5*TIME_FACTOR;
+ flowerParticle.particle[i].position.x -= 2*TIME_FACTOR;
+ flowerParticle.particle[i].rotation += 0.5*TIME_FACTOR;
+ if (flowerParticle.particle[i].position.y >= GetScreenHeight()) flowerParticle.particle[i].active = false;
+ }
+
+ if (backFlowerParticle.particle[i].active)
+ {
+ backFlowerParticle.particle[i].position.y += 2*TIME_FACTOR;
+ backFlowerParticle.particle[i].position.x -= 3*TIME_FACTOR;
+ backFlowerParticle.particle[i].rotation += 0.5*TIME_FACTOR;
+ if (backFlowerParticle.particle[i].position.y >= GetScreenHeight()) backFlowerParticle.particle[i].active = false;
+ }
+
+ if (rainParticle.particle[i].active)
+ {
+ rainParticle.particle[i].position.y += 4*TIME_FACTOR;
+ rainParticle.particle[i].position.x -= 5*TIME_FACTOR;
+ //rainParticle.particle[i].rotation += 0.5;
+ if (rainParticle.particle[i].position.y >= GetScreenHeight()) rainParticle.particle[i].active = false;
+ }
+
+ if (backRainParticle.particle[i].active)
+ {
+ backRainParticle.particle[i].position.y += 3*TIME_FACTOR;
+ backRainParticle.particle[i].position.x -= 3*TIME_FACTOR;
+ //rainParticle.particle[i].rotation += 0.5;
+ if (backRainParticle.particle[i].position.y >= GetScreenHeight()) backRainParticle.particle[i].active = false;
+ }
+ }
+
+ for (int i = 0; i < 1024; i++)
+ {
+ if (rainStormParticle.particle[i].active)
+ {
+ rainStormParticle.particle[i].position.y += 12*TIME_FACTOR;
+ rainStormParticle.particle[i].position.x -= 15*TIME_FACTOR;
+ //rainParticle.particle[i].rotation += 0.5;
+ if (rainStormParticle.particle[i].position.y >= GetScreenHeight()) rainStormParticle.particle[i].active = false;
+ if (rainStormParticle.active == false)rainStormParticle.particle[i].alpha -= 0.01;
+ }
+ }
+
+ for (int i = 0; i < 256; i++)
+ {
+ if (snowStormParticle.particle[i].active)
+ {
+ snowStormParticle.particle[i].position.y += 12;
+ snowStormParticle.particle[i].position.x -= 15;
+ snowStormParticle.particle[i].rotation += 0.5;
+ if (snowStormParticle.particle[i].position.y >= GetScreenHeight()) snowStormParticle.particle[i].active = false;
+ }
+ }
+
+ for (int i = 0; i < 20; i++)
+ {
+ if (rayparticle.particle[i].active)
+ {
+ rayparticle.particle[i].position.x -= 0.5*TIME_FACTOR;
+
+ if (rayparticle.particle[i].fading)
+ {
+ rayparticle.particle[i].alpha -= 0.01f;
+
+ if (rayparticle.particle[i].alpha <= 0)
+ {
+ rayparticle.particle[i].alpha = 0;
+ rayparticle.particle[i].delayCounter++;
+ if (rayparticle.particle[i].delayCounter >= 30)
+ {
+ rayparticle.particle[i].active = false;
+ rayparticle.particle[i].delayCounter = 0;
+ rayparticle.particle[i].fading = false;
+ }
+ }
+ }
+ else
+ {
+ rayparticle.particle[i].alpha += 0.01f;
+
+ if (rayparticle.particle[i].alpha >= 0.5f)
+ {
+ rayparticle.particle[i].alpha = 0.5f;
+ rayparticle.particle[i].delayCounter++;
+
+ if (rayparticle.particle[i].delayCounter >= 30)
+ {
+ rayparticle.particle[i].delayCounter = 0;
+ rayparticle.particle[i].fading = true;
+ }
+ }
+ }
+ }
+
+ if (backRayparticle.particle[i].active)
+ {
+ backRayparticle.particle[i].position.x -= 0.5;
+
+ if (backRayparticle.particle[i].fading)
+ {
+ backRayparticle.particle[i].alpha -= 0.01f;
+ if (backRayparticle.particle[i].alpha <= 0)
+ {
+ backRayparticle.particle[i].alpha = 0;
+ backRayparticle.particle[i].delayCounter++;
+ if (backRayparticle.particle[i].delayCounter >= 30)
+ {
+ backRayparticle.particle[i].active = false;
+ backRayparticle.particle[i].delayCounter = 0;
+ backRayparticle.particle[i].fading = false;
+ }
+ }
+ }
+ else
+ {
+ backRayparticle.particle[i].alpha += 0.01f;
+ if (backRayparticle.particle[i].alpha >= 0.5f)
+ {
+ backRayparticle.particle[i].alpha = 0.5f;
+ backRayparticle.particle[i].delayCounter++;
+ if (backRayparticle.particle[i].delayCounter >= 30)
+ {
+ backRayparticle.particle[i].delayCounter = 0;
+ backRayparticle.particle[i].fading = true;
+ }
+ }
+ }
+ }
+ }
+
+ // Press enter to change to GAMEPLAY screen
+#if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
+ if (((IsGestureDetected(GESTURE_TAP) || (GetGestureDetected() == GESTURE_DOUBLETAP)) && framesCounter >= duration))
+ {
+ //finishScreen = 1; // OPTIONS
+ finishScreen = 2; // GAMEPLAY
+ }
+#elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
+ if ((IsKeyPressed(KEY_ENTER) && framesCounter >= duration))
+ {
+ //finishScreen = 1; // OPTIONS
+ finishScreen = 2; // GAMEPLAY
+ }
+#endif
+}
+
+// Title Screen Draw logic
+void DrawTitleScreen(void)
+{
+ BeginShaderMode(colorBlend);
+
+ DrawTexturePro(atlas02,gameplay_background, (Rectangle){0, 0, gameplay_background.width*2, gameplay_background.height*2}, (Vector2){0, 0}, 0, color02);
+
+ // Draw parallax
+ DrawParallaxBack();
+ DrawParallaxMiddle();
+
+ for (int i = 0; i < MAX_particle; i++)
+ {
+ if (backSnowParticle.particle[i].active) DrawTexturePro(atlas02, particle_icecrystal_bw,
+ (Rectangle){ backSnowParticle.particle[i].position.x, backSnowParticle.particle[i].position.y, particle_icecrystal_bw.width*backSnowParticle.particle[i].size, particle_icecrystal_bw.height*backSnowParticle.particle[i].size },
+ (Vector2){ particle_icecrystal_bw.width*backSnowParticle.particle[i].size/2, particle_icecrystal_bw.height*backSnowParticle.particle[i].size/2 }, backSnowParticle.particle[i].rotation,
+ Fade((Color){144, 214, 255, 255}, backSnowParticle.particle[i].alpha));
+
+ if (backPlanetreeParticle.particle[i].active) DrawTexturePro(atlas02, particle_planetreeleaf_bw,
+ (Rectangle){ backPlanetreeParticle.particle[i].position.x, backPlanetreeParticle.particle[i].position.y, particle_planetreeleaf_bw.width*backPlanetreeParticle.particle[i].size, particle_planetreeleaf_bw.height*backPlanetreeParticle.particle[i].size },
+ (Vector2){ particle_planetreeleaf_bw.width*backPlanetreeParticle.particle[i].size/2, particle_planetreeleaf_bw.height*backPlanetreeParticle.particle[i].size/2 }, backPlanetreeParticle.particle[i].rotation,
+ Fade((Color){179, 86, 6, 255}, backPlanetreeParticle.particle[i].alpha));
+
+ if (dandelionBackParticle.particle[i].active) DrawTexturePro(atlas02, particle_dandelion_bw,
+ (Rectangle){ dandelionBackParticle.particle[i].position.x, dandelionBackParticle.particle[i].position.y, particle_dandelion_bw.width*dandelionBackParticle.particle[i].size, particle_dandelion_bw.height*dandelionBackParticle.particle[i].size },
+ (Vector2){ particle_dandelion_bw.width*dandelionBackParticle.particle[i].size/2, particle_dandelion_bw.height*dandelionBackParticle.particle[i].size/2 }, dandelionBackParticle.particle[i].rotation,
+ Fade((Color){202, 167, 126, 255}, dandelionBackParticle.particle[i].alpha));
+
+ if (backFlowerParticle.particle[i].active) DrawTexturePro(atlas02, particle_ecualyptusflower_bw,
+ (Rectangle){ backFlowerParticle.particle[i].position.x, backFlowerParticle.particle[i].position.y, particle_ecualyptusflower_bw.width*backFlowerParticle.particle[i].size, particle_ecualyptusflower_bw.height*backFlowerParticle.particle[i].size },
+ (Vector2){ particle_ecualyptusflower_bw.width*backFlowerParticle.particle[i].size/2, particle_ecualyptusflower_bw.height*backFlowerParticle.particle[i].size/2 }, backFlowerParticle.particle[i].rotation,
+ Fade((Color){218, 84, 108, 255}, backFlowerParticle.particle[i].alpha));
+
+ if (backRainParticle.particle[i].active) DrawTexturePro(atlas02, particle_waterdrop_bw,
+ (Rectangle){ backRainParticle.particle[i].position.x, backRainParticle.particle[i].position.y, particle_waterdrop_bw.width*backRainParticle.particle[i].size, particle_waterdrop_bw.height*backRainParticle.particle[i].size },
+ (Vector2){ particle_waterdrop_bw.width*backRainParticle.particle[i].size/2, particle_waterdrop_bw.height*backRainParticle.particle[i].size/2 }, backRainParticle.particle[i].rotation,
+ Fade((Color){144, 183, 187, 255}, backRainParticle.particle[i].alpha));
+ }
+
+ for (int i = 0; i < 20; i++)
+ {
+ if (backRayparticle.particle[i].active) DrawTexturePro(atlas02, gameplay_back_fx_lightraymid,
+ (Rectangle){ backRayparticle.particle[i].position.x, backRayparticle.particle[i].position.y, gameplay_back_fx_lightraymid.width*backRayparticle.particle[i].size, gameplay_back_fx_lightraymid.height*backRayparticle.particle[i].size },
+ (Vector2){ gameplay_back_fx_lightraymid.width*backRayparticle.particle[i].size/2, gameplay_back_fx_lightraymid.height*backRayparticle.particle[i].size/2 }, backRayparticle.particle[i].rotation,
+ Fade(GOLD, backRayparticle.particle[i].alpha));
+ }
+
+ DrawParallaxFront();
+
+ for (int i = 0; i < 5; i++)
+ {
+ DrawTexturePro(atlas02, gameplay_props_tree, (Rectangle){bamboo[i].x, bamboo[i].y, 43, 720}, (Vector2){0, 0}, 0, color03);
+ //DrawRectangleRec(bamboo[i], Fade(LIME, 0.5));
+ }
+
+ EndShaderMode();
+
+ DrawTextureRec(atlas01, koalaMenu, (Vector2){player.x - player.width, player.y - 40}, WHITE);
+
+ BeginShaderMode(colorBlend);
+
+ DrawTexturePro(atlas02, gameplay_back_ground00, (Rectangle){0, 637, gameplay_back_ground00.width*2, gameplay_back_ground00.height*2}, (Vector2){0,0}, 0, color00);
+
+ EndShaderMode();
+
+ DrawTexturePro(atlas01, (Rectangle){title_titletext.x, title_titletext.y, title_titletext.width, 230}, (Rectangle){GetScreenWidth()*0.49F - title_titletext.width/2, currentValue1, title_titletext.width, 235}, (Vector2){0, 0}, 0, WHITE);
+ DrawTexturePro(atlas01, (Rectangle){title_titletext.x, title_titletext.y + 232, title_titletext.width, 116}, (Rectangle){GetScreenWidth()*0.49F - title_titletext.width/2, currentValue2, title_titletext.width, 116}, (Vector2){0, 0}, 0, WHITE);
+
+ if ((framesCounter/60)%2 && framesCounter >= duration) DrawTextEx(font, pressToPlay, (Vector2){ GetScreenWidth()/2 - fontSize.x/2, GetScreenHeight()/2 + fontSize.y*2 }, font.size, 2, (Color){247, 239, 209, 255});
+
+ for (int i = 0; i < MAX_particle; i++)
+ {
+ if (snowParticle.particle[i].active) DrawTexturePro(atlas01, particle_icecrystal,
+ (Rectangle){ snowParticle.particle[i].position.x, snowParticle.particle[i].position.y, particle_icecrystal.width*snowParticle.particle[i].size, particle_icecrystal.height*snowParticle.particle[i].size },
+ (Vector2){ particle_icecrystal.width*snowParticle.particle[i].size/2, particle_icecrystal.height*snowParticle.particle[i].size/2 }, snowParticle.particle[i].rotation,
+ Fade(snowParticle.particle[i].color, snowParticle.particle[i].alpha));
+
+ if (planetreeParticle.particle[i].active) DrawTexturePro(atlas01, particle_planetreeleaf,
+ (Rectangle){ planetreeParticle.particle[i].position.x, planetreeParticle.particle[i].position.y, particle_planetreeleaf.width*planetreeParticle.particle[i].size, particle_planetreeleaf.height*planetreeParticle.particle[i].size },
+ (Vector2){ particle_planetreeleaf.width*planetreeParticle.particle[i].size/2, particle_planetreeleaf.height*planetreeParticle.particle[i].size/2 }, planetreeParticle.particle[i].rotation,
+ Fade(planetreeParticle.particle[i].color, planetreeParticle.particle[i].alpha));
+
+ if (dandelionParticle.particle[i].active) DrawTexturePro(atlas01, particle_dandelion,
+ (Rectangle){ dandelionParticle.particle[i].position.x, dandelionParticle.particle[i].position.y, particle_dandelion.width*dandelionParticle.particle[i].size, particle_dandelion.height*dandelionParticle.particle[i].size },
+ (Vector2){ particle_dandelion.width*dandelionParticle.particle[i].size/2, particle_dandelion.height*dandelionParticle.particle[i].size/2 }, dandelionParticle.particle[i].rotation,
+ Fade(dandelionParticle.particle[i].color, dandelionParticle.particle[i].alpha));
+
+ if (flowerParticle.particle[i].active) DrawTexturePro(atlas01, particle_ecualyptusflower,
+ (Rectangle){ flowerParticle.particle[i].position.x, flowerParticle.particle[i].position.y, particle_ecualyptusflower.width*flowerParticle.particle[i].size, particle_ecualyptusflower.height*flowerParticle.particle[i].size },
+ (Vector2){ particle_ecualyptusflower.width*flowerParticle.particle[i].size/2, particle_ecualyptusflower.height*flowerParticle.particle[i].size/2 }, flowerParticle.particle[i].rotation,
+ Fade(flowerParticle.particle[i].color, flowerParticle.particle[i].alpha));
+
+ if (rainParticle.particle[i].active) DrawTexturePro(atlas01, particle_waterdrop,
+ (Rectangle){ rainParticle.particle[i].position.x, rainParticle.particle[i].position.y, particle_waterdrop.width*rainParticle.particle[i].size, particle_waterdrop.height*rainParticle.particle[i].size },
+ (Vector2){ particle_waterdrop.width*rainParticle.particle[i].size/2, particle_waterdrop.height*rainParticle.particle[i].size/2 }, rainParticle.particle[i].rotation,
+ Fade(rainParticle.particle[i].color, rainParticle.particle[i].alpha));
+
+ }
+
+ for (int i = 0; i < 1024; i++)
+ {
+ if (rainStormParticle.particle[i].active) DrawTexturePro(atlas01, particle_waterdrop,
+ (Rectangle){ rainStormParticle.particle[i].position.x, rainStormParticle.particle[i].position.y, particle_waterdrop.width*rainStormParticle.particle[i].size, particle_waterdrop.height*rainStormParticle.particle[i].size },
+ (Vector2){ particle_waterdrop.width*rainStormParticle.particle[i].size/2, particle_waterdrop.height*rainStormParticle.particle[i].size/2 }, rainStormParticle.particle[i].rotation,
+ Fade(rainStormParticle.particle[i].color, rainStormParticle.particle[i].alpha));
+ }
+
+ for (int i = 0; i < 256; i++)
+ {
+
+ if (snowStormParticle.particle[i].active) DrawTexturePro(atlas01, particle_icecrystal,
+ (Rectangle){ snowStormParticle.particle[i].position.x, snowStormParticle.particle[i].position.y, particle_icecrystal.width*snowStormParticle.particle[i].size, particle_icecrystal.height*snowStormParticle.particle[i].size },
+ (Vector2){ particle_icecrystal.width*snowStormParticle.particle[i].size/2, particle_icecrystal.height*snowStormParticle.particle[i].size/2 }, snowStormParticle.particle[i].rotation,
+ Fade(snowStormParticle.particle[i].color, snowStormParticle.particle[i].alpha));
+ }
+
+
+ for (int i = 0; i < 20; i++)
+ {
+
+ if (rayparticle.particle[i].active) DrawTexturePro(atlas01, gameplay_fx_lightraymid,
+ (Rectangle){ rayparticle.particle[i].position.x, rayparticle.particle[i].position.y, gameplay_fx_lightraymid.width*rayparticle.particle[i].size, gameplay_fx_lightraymid.height*rayparticle.particle[i].size },
+ (Vector2){ gameplay_fx_lightraymid.width*rayparticle.particle[i].size/2, gameplay_fx_lightraymid.height*rayparticle.particle[i].size/2 }, rayparticle.particle[i].rotation,
+ Fade(rayparticle.particle[i].color, rayparticle.particle[i].alpha));
+ }
+
+ /*
+ DrawTexturePro(atlas01, title_twitter, (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.1, title_twitter.width, title_twitter.height}, (Vector2){0,0}, 0, WHITE);
+ DrawTexturePro(atlas01, title_facebook, (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.3, title_facebook.width, title_facebook.height}, (Vector2){0,0}, 0, WHITE);
+ DrawTexturePro(atlas01, title_googleplay, (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.5, title_googleplay.width, title_googleplay.height}, (Vector2){0,0}, 0, WHITE);
+
+ if (soundActive)DrawTexturePro(atlas01, title_music_on, (Rectangle){soundButton.x, soundButton.y, title_music_on.width, title_music_on.height}, (Vector2){0,0}, 0, WHITE);
+ else DrawTexturePro(atlas01, title_music_off, (Rectangle){soundButton.x, soundButton.y, title_music_off.width, title_music_off.height}, (Vector2){0,0}, 0, WHITE);
+
+ if (musicActive)DrawTexturePro(atlas01, title_speaker_on, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_on.width, title_speaker_on.height}, (Vector2){0,0}, 0, WHITE);
+ else DrawTexturePro(atlas01, title_speaker_off, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_off.width, title_speaker_off.height}, (Vector2){0,0}, 0, WHITE);
+ */
+}
+
+// Title Screen Unload logic
+void UnloadTitleScreen(void)
+{
+ // ...
+}
+
+// Title Screen should finish?
+int FinishTitleScreen(void)
+{
+ return finishScreen;
+}
+
+static void DrawParallaxFront(void)
+{
+ Rectangle ground01 = gameplay_back_ground01;
+
+ //DrawTexturePro(atlas02, gameplay_back_tree01_layer03, (Rectangle){0, 21, gameplay_back_tree01_layer03.width*2, gameplay_back_tree01_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree01_layer01, (Rectangle){(int)parallaxFrontOffset, 60, gameplay_back_tree01_layer01.width*2, gameplay_back_tree01_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree02_layer01, (Rectangle){(int)parallaxFrontOffset + 140, 60, gameplay_back_tree02_layer01.width*2, gameplay_back_tree02_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree03_layer01, (Rectangle){(int)parallaxFrontOffset + 140*2, 55, gameplay_back_tree02_layer01.width*2, gameplay_back_tree02_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree04_layer01, (Rectangle){(int)parallaxFrontOffset + 140*3, 60, gameplay_back_tree04_layer01.width*2, gameplay_back_tree04_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree05_layer01, (Rectangle){(int)parallaxFrontOffset + 140*4, 60, gameplay_back_tree05_layer01.width*2, gameplay_back_tree05_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree06_layer01, (Rectangle){(int)parallaxFrontOffset + 140*5, 55, gameplay_back_tree06_layer01.width*2, gameplay_back_tree06_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree07_layer01, (Rectangle){(int)parallaxFrontOffset + 140*6, 60, gameplay_back_tree07_layer01.width*2, gameplay_back_tree07_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree08_layer01, (Rectangle){(int)parallaxFrontOffset + 140*7, 60, gameplay_back_tree08_layer01.width*2, gameplay_back_tree08_layer01.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_ground01, (Rectangle){0, 559, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
+ DrawTexturePro(atlas02, (Rectangle){ground01.x, ground01.y + ground01.height, ground01.width, -ground01.height}, (Rectangle){0, -33, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
+ }
+
+static void DrawParallaxMiddle(void)
+{
+ Rectangle ground02 = gameplay_back_ground02;
+
+ //DrawTexturePro(atlas02, gameplay_back_tree02_layer03, (Rectangle){0, 67, gameplay_back_tree02_layer03.width*2, gameplay_back_tree02_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree01_layer02, (Rectangle){(int)0, 67, gameplay_back_tree01_layer02.width*2, gameplay_back_tree01_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree02_layer02, (Rectangle){(int)140, 67, gameplay_back_tree02_layer02.width*2, gameplay_back_tree02_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree03_layer02, (Rectangle){(int)140*2, 67, gameplay_back_tree03_layer02.width*2, gameplay_back_tree03_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree04_layer02, (Rectangle){(int)140*3, 67, gameplay_back_tree04_layer02.width*2, gameplay_back_tree04_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree05_layer02, (Rectangle){(int)140*4, 67, gameplay_back_tree05_layer02.width*2, gameplay_back_tree05_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree06_layer02, (Rectangle){(int)140*5, 67, gameplay_back_tree06_layer02.width*2, gameplay_back_tree06_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree07_layer02, (Rectangle){(int)140*6, 67, gameplay_back_tree07_layer02.width*2, gameplay_back_tree07_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree08_layer02, (Rectangle){(int)140*7, 67, gameplay_back_tree08_layer02.width*2, gameplay_back_tree08_layer02.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_ground02, (Rectangle){0, 509, ground02.width*2, ground02.height*2}, (Vector2){0,0}, 0, color01);
+ DrawTexturePro(atlas02, (Rectangle){ground02.x, ground02.y + ground02.height, ground02.width, -ground02.height}, (Rectangle){0, 19, ground02.width*2, ground02.height*2}, (Vector2){0,0}, 0, color01);
+}
+
+static void DrawParallaxBack(void)
+{
+ Rectangle ground03 = gameplay_back_ground03;
+
+ //DrawTexturePro(atlas02, gameplay_back_tree02_layer03, (Rectangle){0, 67, gameplay_back_tree02_layer03.width*2, gameplay_back_tree02_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree01_layer03, (Rectangle){(int)parallaxBackOffset, 67, gameplay_back_tree01_layer03.width*2, gameplay_back_tree01_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree02_layer03, (Rectangle){(int)parallaxBackOffset + 140, 67, gameplay_back_tree02_layer03.width*2, gameplay_back_tree02_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree03_layer03, (Rectangle){(int)parallaxBackOffset + 140*2, 67, gameplay_back_tree03_layer03.width*2, gameplay_back_tree03_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree04_layer03, (Rectangle){(int)parallaxBackOffset + 140*3, 67, gameplay_back_tree04_layer03.width*2, gameplay_back_tree04_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree05_layer03, (Rectangle){(int)parallaxBackOffset + 140*4, 67, gameplay_back_tree05_layer03.width*2, gameplay_back_tree05_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree06_layer03, (Rectangle){(int)parallaxBackOffset + 140*5, 67, gameplay_back_tree06_layer03.width*2, gameplay_back_tree06_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree07_layer03, (Rectangle){(int)parallaxBackOffset + 140*6, 67, gameplay_back_tree07_layer03.width*2, gameplay_back_tree07_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_tree08_layer03, (Rectangle){(int)parallaxBackOffset + 140*7, 67, gameplay_back_tree08_layer03.width*2, gameplay_back_tree08_layer03.height*2}, (Vector2){0,0}, 0, color02);
+ DrawTexturePro(atlas02, gameplay_back_ground03, (Rectangle){0, 469, ground03.width*2, ground03.height*2}, (Vector2){0,0}, 0, color01);
+ DrawTexturePro(atlas02, (Rectangle){ground03.x, ground03.y + ground03.height, ground03.width, -ground03.height}, (Rectangle){0, 67, ground03.width*2, ground03.height*2}, (Vector2){0,0}, 0, color01);
+}
+
+static float BounceEaseOut(float t,float b , float c, float d)
+{
+ if ((t/=d) < (1/2.75f)) {
+ return c*(7.5625f*t*t) + b;
+ } else if (t < (2/2.75f)) {
+ float postFix = t-=(1.5f/2.75f);
+ return c*(7.5625f*(postFix)*t + .75f) + b;
+ } else if (t < (2.5/2.75)) {
+ float postFix = t-=(2.25f/2.75f);
+ return c*(7.5625f*(postFix)*t + .9375f) + b;
+ } else {
+ float postFix = t-=(2.625f/2.75f);
+ return c*(7.5625f*(postFix)*t + .984375f) + b;
+ }
+} \ No newline at end of file
diff --git a/games/koala_seasons/screens/screens.h b/games/koala_seasons/screens/screens.h
new file mode 100644
index 00000000..ba62aa27
--- /dev/null
+++ b/games/koala_seasons/screens/screens.h
@@ -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 \ No newline at end of file