Merge branch 'master' into i-cant-think-of-a-name

This commit is contained in:
Leandro Gabriel 2019-08-02 21:22:19 -03:00
commit 50786b655b
33 changed files with 2345 additions and 864 deletions

2
.github/FUNDING.yml vendored
View file

@ -1,6 +1,6 @@
# These are supported funding model platforms # These are supported funding model platforms
github: # soon github: raysan5
patreon: raylib patreon: raylib
open_collective: # Replace with a single Open Collective username open_collective: # Replace with a single Open Collective username
ko_fi: raysan ko_fi: raysan

View file

@ -243,7 +243,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference. # logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif
@ -365,6 +365,7 @@ EXAMPLES = \
core/core_window_letterbox \ core/core_window_letterbox \
core/core_drop_files \ core/core_drop_files \
core/core_random_values \ core/core_random_values \
core/core_scissor_test \
core/core_storage_values \ core/core_storage_values \
core/core_vr_simulator \ core/core_vr_simulator \
core/core_loading_thread \ core/core_loading_thread \
@ -394,6 +395,7 @@ EXAMPLES = \
text/text_rectangle_bounds \ text/text_rectangle_bounds \
text/text_unicode \ text/text_unicode \
textures/textures_logo_raylib \ textures/textures_logo_raylib \
textures/textures_mouse_painting \
textures/textures_rectangle \ textures/textures_rectangle \
textures/textures_srcrec_dstrec \ textures/textures_srcrec_dstrec \
textures/textures_image_drawing \ textures/textures_image_drawing \

View file

@ -0,0 +1,71 @@
/*******************************************************************************************
*
* raylib [core] example - Scissor test
*
* This example has been created using raylib 2.5 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Example contributed by Chris Dill (@MysteriousSpace) and reviewed by Ramon Santamaria (@raysan5)
*
* Copyright (c) 2019 Chris Dill (@MysteriousSpace)
*
********************************************************************************************/
#include "raylib.h"
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - scissor test");
Rectangle scissorArea = { 0, 0, 300, 300 };
bool scissorMode = true;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_S)) scissorMode = !scissorMode;
// Centre the scissor area around the mouse position
scissorArea.x = GetMouseX() - scissorArea.width/2;
scissorArea.y = GetMouseY() - scissorArea.height/2;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
if (scissorMode) BeginScissorMode(scissorArea.x, scissorArea.y, scissorArea.width, scissorArea.height);
// Draw full screen rectangle and some text
// NOTE: Only part defined by scissor area will be rendered
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), RED);
DrawText("Move the mouse around to reveal this text!", 190, 200, 20, LIGHTGRAY);
if (scissorMode) EndScissorMode();
DrawRectangleLinesEx(scissorArea, 1, BLACK);
DrawText("Press S to toggle scissor test", 10, 10, 20, BLACK);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -29,7 +29,7 @@ int main(void)
int gameScreenWidth = 640; int gameScreenWidth = 640;
int gameScreenHeight = 480; int gameScreenHeight = 480;
// Render texture initialization // Render texture initialization, used to hold the rendering result so we can easily resize it
RenderTexture2D target = LoadRenderTexture(gameScreenWidth, gameScreenHeight); RenderTexture2D target = LoadRenderTexture(gameScreenWidth, gameScreenHeight);
SetTextureFilter(target.texture, FILTER_BILINEAR); // Texture scale filter to use SetTextureFilter(target.texture, FILTER_BILINEAR); // Texture scale filter to use
@ -59,7 +59,7 @@ int main(void)
BeginDrawing(); BeginDrawing();
ClearBackground(BLACK); ClearBackground(BLACK);
// Draw everything in the render texture // Draw everything in the render texture, note this will not be rendered on screen, yet
BeginTextureMode(target); BeginTextureMode(target);
ClearBackground(RAYWHITE); // Clear render texture background color ClearBackground(RAYWHITE); // Clear render texture background color

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,210 @@
/*******************************************************************************************
*
* raylib [textures] example - Mouse painting
*
* This example has been created using raylib 2.5 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Example contributed by Chris Dill (@MysteriousSpace) and reviewed by Ramon Santamaria (@raysan5)
*
* Copyright (c) 2019 Chris Dill (@MysteriousSpace) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define MAX_COLORS_COUNT 23 // Number of colors available
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] example - mouse painting");
// Colours to choose from
Color colors[MAX_COLORS_COUNT] = {
RAYWHITE, YELLOW, GOLD, ORANGE, PINK, RED, MAROON, GREEN, LIME, DARKGREEN,
SKYBLUE, BLUE, DARKBLUE, PURPLE, VIOLET, DARKPURPLE, BEIGE, BROWN, DARKBROWN,
LIGHTGRAY, GRAY, DARKGRAY, BLACK };
// Define colorsRecs data (for every rectangle)
Rectangle colorsRecs[MAX_COLORS_COUNT] = { 0 };
for (int i = 0; i < MAX_COLORS_COUNT; i++)
{
colorsRecs[i].x = 10 + 30*i + 2*i;
colorsRecs[i].y = 10;
colorsRecs[i].width = 30;
colorsRecs[i].height = 30;
}
int colorSelected = 0;
int colorSelectedPrev = colorSelected;
int colorMouseHover = 0;
int brushSize = 20;
Rectangle btnSaveRec = { 750, 10, 40, 30 };
bool btnSaveMouseHover = false;
bool showSaveMessage = false;
int saveMessageCounter = 0;
// Create a RenderTexture2D to use as a canvas
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
// Clear render texture before entering the game loop
BeginTextureMode(target);
ClearBackground(colors[0]);
EndTextureMode();
SetTargetFPS(120); // Set our game to run at 120 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
Vector2 mousePos = GetMousePosition();
// Move between colors with keys
if (IsKeyPressed(KEY_RIGHT)) colorSelected++;
else if (IsKeyPressed(KEY_LEFT)) colorSelected--;
if (colorSelected >= MAX_COLORS_COUNT) colorSelected = MAX_COLORS_COUNT - 1;
else if (colorSelected < 0) colorSelected = 0;
// Choose color with mouse
for (int i = 0; i < MAX_COLORS_COUNT; i++)
{
if (CheckCollisionPointRec(mousePos, colorsRecs[i]))
{
colorMouseHover = i;
break;
}
else colorMouseHover = -1;
}
if ((colorMouseHover >= 0) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{
colorSelected = colorMouseHover;
colorSelectedPrev = colorSelected;
}
// Change brush size
brushSize += GetMouseWheelMove()*5;
if (brushSize < 2) brushSize = 2;
if (brushSize > 50) brushSize = 50;
if (IsKeyPressed(KEY_C))
{
// Clear render texture to clear color
BeginTextureMode(target);
ClearBackground(colors[0]);
EndTextureMode();
}
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
{
// Paint circle into render texture
// NOTE: To avoid discontinuous circles, we could store
// previous-next mouse points and just draw a line using brush size
BeginTextureMode(target);
if (mousePos.y > 50) DrawCircle(mousePos.x, mousePos.y, brushSize, colors[colorSelected]);
EndTextureMode();
}
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON))
{
colorSelected = 0;
// Erase circle from render texture
BeginTextureMode(target);
if (mousePos.y > 50) DrawCircle(mousePos.x, mousePos.y, brushSize, colors[0]);
EndTextureMode();
}
else colorSelected = colorSelectedPrev;
// Check mouse hover save button
if (CheckCollisionPointRec(mousePos, btnSaveRec)) btnSaveMouseHover = true;
else btnSaveMouseHover = false;
// Image saving logic
// NOTE: Saving painted texture to a default named image
if ((btnSaveMouseHover && IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) || IsKeyPressed(KEY_S))
{
Image image = GetTextureData(target.texture);
ImageFlipVertical(&image);
ExportImage(image, "my_amazing_texture_painting.png");
UnloadImage(image);
showSaveMessage = true;
}
if (showSaveMessage)
{
// On saving, show a full screen message for 2 seconds
saveMessageCounter++;
if (saveMessageCounter > 240)
{
showSaveMessage = false;
saveMessageCounter = 0;
}
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
// Draw drawing circle for reference
if (mousePos.y > 50)
{
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) DrawCircleLines(mousePos.x, mousePos.y, brushSize, colors[colorSelected]);
else DrawCircle(GetMouseX(), GetMouseY(), brushSize, colors[colorSelected]);
}
// Draw top panel
DrawRectangle(0, 0, GetScreenWidth(), 50, RAYWHITE);
DrawLine(0, 50, GetScreenWidth(), 50, LIGHTGRAY);
// Draw color selection rectangles
for (int i = 0; i < MAX_COLORS_COUNT; i++) DrawRectangleRec(colorsRecs[i], colors[i]);
DrawRectangleLines(10, 10, 30, 30, LIGHTGRAY);
if (colorMouseHover >= 0) DrawRectangleRec(colorsRecs[colorMouseHover], Fade(WHITE, 0.6f));
DrawRectangleLinesEx((Rectangle){ colorsRecs[colorSelected].x - 2, colorsRecs[colorSelected].y - 2,
colorsRecs[colorSelected].width + 4, colorsRecs[colorSelected].height + 4 }, 2, BLACK);
// Draw save image button
DrawRectangleLinesEx(btnSaveRec, 2, btnSaveMouseHover? RED : BLACK);
DrawText("SAVE!", 755, 20, 10, btnSaveMouseHover? RED : BLACK);
// Draw save image message
if (showSaveMessage)
{
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
DrawRectangle(0, 150, GetScreenWidth(), 80, BLACK);
DrawText("IMAGE SAVED: my_amazing_texture_painting.png", 150, 180, 20, RAYWHITE);
}
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadRenderTexture(target); // Unload render texture
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

View file

@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

View file

@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

View file

@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

View file

@ -200,7 +200,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# resource file contains windows executable icon and properties # resource file contains windows executable icon and properties
# -Wl,--subsystem,windows hides the console window # -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows CFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
ifeq ($(RAYLIB_LIBTYPE),STATIC) ifeq ($(RAYLIB_LIBTYPE),STATIC)
@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

View file

@ -59,9 +59,9 @@ int main(void)
atlas02 = LoadTexture("resources/graphics/atlas02.png"); atlas02 = LoadTexture("resources/graphics/atlas02.png");
#if defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_ANDROID) #if defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_ANDROID)
colorBlend = LoadShader("resources/shaders/glsl100/base.vs", "resources/shaders/glsl100/blend_color.fs"); colorBlend = LoadShader(0, "resources/shaders/glsl100/blend_color.fs");
#else #else
colorBlend = LoadShader("resources/shaders/glsl330/base.vs", "resources/shaders/glsl330/blend_color.fs"); colorBlend = LoadShader(0, "resources/shaders/glsl330/blend_color.fs");
#endif #endif
InitAudioDevice(); InitAudioDevice();
@ -76,20 +76,14 @@ int main(void)
fxDieDingo = LoadSound("resources/audio/dingo_die.ogg"); fxDieDingo = LoadSound("resources/audio/dingo_die.ogg");
fxDieOwl = LoadSound("resources/audio/owl_die.ogg"); fxDieOwl = LoadSound("resources/audio/owl_die.ogg");
music = LoadMusicStream("resources/audio/jngl.xm"); music = LoadMusicStream("resources/audio/jngl.xm");
PlayMusicStream(music); PlayMusicStream(music);
SetMusicVolume(music, 1.0f); SetMusicVolume(music, 2.0f);
// Define and init first screen // Define and init first screen
// NOTE: currentScreen is defined in screens.h as a global variable // NOTE: currentScreen is defined in screens.h as a global variable
currentScreen = TITLE; currentScreen = TITLE;
InitLogoScreen();
//InitOptionsScreen();
InitTitleScreen(); InitTitleScreen();
InitGameplayScreen();
InitEndingScreen();
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1); emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
@ -257,9 +251,7 @@ void UpdateDrawFrame(void)
} }
if (onTransition) DrawTransition(); if (onTransition) DrawTransition();
DrawFPS(20, GetScreenHeight() - 30);
DrawRectangle(GetScreenWidth() - 200, GetScreenHeight() - 50, 200, 40, Fade(WHITE, 0.6f)); DrawRectangle(GetScreenWidth() - 200, GetScreenHeight() - 50, 200, 40, Fade(WHITE, 0.6f));
DrawText("ALPHA VERSION", GetScreenWidth() - 180, GetScreenHeight() - 40, 20, DARKGRAY); DrawText("ALPHA VERSION", GetScreenWidth() - 180, GetScreenHeight() - 40, 20, DARKGRAY);

View file

@ -38,7 +38,6 @@
//#define DEBUG //#define DEBUG
// DONE: Review MAX_* limits, don't waste memory!!!
#define MAX_ENEMIES 16 #define MAX_ENEMIES 16
#define MAX_BAMBOO 16 #define MAX_BAMBOO 16
#define MAX_LEAVES 14 #define MAX_LEAVES 14
@ -96,7 +95,7 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
typedef enum { WINTER, SPRING, SUMMER, FALL, TRANSITION} SeasonState; typedef enum { WINTER, SPRING, SUMMER, FALL, TRANSITION } SeasonState;
typedef enum { JUMPING, KICK, FINALFORM, GRABED, ONWIND } KoalaState; typedef enum { JUMPING, KICK, FINALFORM, GRABED, ONWIND } KoalaState;
typedef struct { typedef struct {
@ -343,7 +342,6 @@ static Rectangle leftButton = {0, 0, 0, 0};
static Rectangle rightButton = {0, 0, 0, 0}; static Rectangle rightButton = {0, 0, 0, 0};
static Rectangle powerButton = {0, 0, 0, 0}; static Rectangle powerButton = {0, 0, 0, 0};
static Rectangle fire[MAX_FIRE]; static Rectangle fire[MAX_FIRE];
//static Rectangle flames[MAX_FLAMES];
static Rectangle ice[MAX_ICE]; static Rectangle ice[MAX_ICE];
static Rectangle resin[MAX_RESIN]; static Rectangle resin[MAX_RESIN];
static Rectangle wind[MAX_WIND]; static Rectangle wind[MAX_WIND];
@ -351,7 +349,7 @@ static Rectangle bamboo[MAX_BAMBOO];
static Rectangle snake[MAX_ENEMIES]; static Rectangle snake[MAX_ENEMIES];
static Rectangle dingo[MAX_ENEMIES]; static Rectangle dingo[MAX_ENEMIES];
static Rectangle owl[MAX_ENEMIES]; static Rectangle owl[MAX_ENEMIES];
static Rectangle leaf[MAX_LEAVES]; // DONE: Review name! static Rectangle leaf[MAX_LEAVES];
static Rectangle powerBar; static Rectangle powerBar;
static Rectangle backBar; static Rectangle backBar;
static Rectangle fireAnimation; static Rectangle fireAnimation;
@ -387,7 +385,7 @@ static Vector2 textSize;
static Vector2 clockPosition; static Vector2 clockPosition;
static Particle enemyHit[MAX_ENEMIES]; 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 leafParticles[MAX_LEAVES];
static ParticleSystem snowParticle; static ParticleSystem snowParticle;
static ParticleSystem backSnowParticle; static ParticleSystem backSnowParticle;
static ParticleSystem dandelionParticle; static ParticleSystem dandelionParticle;
@ -670,7 +668,7 @@ void UpdateGameplayScreen(void)
transitionFramesCounter += speedMod*TIME_FACTOR; transitionFramesCounter += speedMod*TIME_FACTOR;
if(transitionFramesCounter <= SEASONTRANSITION) if (transitionFramesCounter <= SEASONTRANSITION)
{ {
color00 = ColorTransition(initcolor00, finalcolor00, transitionFramesCounter); color00 = ColorTransition(initcolor00, finalcolor00, transitionFramesCounter);
color01 = ColorTransition(initcolor01, finalcolor01, transitionFramesCounter); color01 = ColorTransition(initcolor01, finalcolor01, transitionFramesCounter);
@ -1043,12 +1041,8 @@ void UpdateGameplayScreen(void)
#endif #endif
} }
#if defined(DEBUG) #if defined(DEBUG)
if (currentLeaves < LEAVESTOTRANSFORM && (IsKeyPressed(KEY_ENTER))) if ((currentLeaves < LEAVESTOTRANSFORM) && (IsKeyPressed(KEY_ENTER))) currentLeaves += LEAVESTOTRANSFORM;
{
currentLeaves += LEAVESTOTRANSFORM;
}
#endif #endif
if (coolDown) if (coolDown)
{ {
power += 20; power += 20;
@ -1427,10 +1421,6 @@ void UpdateGameplayScreen(void)
if (CheckCollisionRecs(player, leaf[j]) && leafActive[j]) 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].position = (Vector2){ leaf[j].x, leaf[j].y };
popupLeaves[j].scale = 1.0f; popupLeaves[j].scale = 1.0f;
popupLeaves[j].alpha = 1.0f; popupLeaves[j].alpha = 1.0f;
@ -1438,25 +1428,25 @@ void UpdateGameplayScreen(void)
PlaySound(fxEatLeaves); PlaySound(fxEatLeaves);
if(leafType[j] == 0) if (leafType[j] == 0)
{ {
currentLeaves++; currentLeaves++;
popupLeaves[j].score = 1; popupLeaves[j].score = 1;
} }
else if(leafType[j] == 1) else if (leafType[j] == 1)
{ {
currentLeaves += 2; currentLeaves += 2;
popupLeaves[j].score = 2; popupLeaves[j].score = 2;
} }
else if(leafType[j] == 2) else if (leafType[j] == 2)
{ {
currentLeaves += 3; currentLeaves += 3;
popupLeaves[j].score = 3; popupLeaves[j].score = 3;
} }
else if(leafType[j] == 3) else if (leafType[j] == 3)
{ {
currentLeaves += 4; currentLeaves += 4;
popupLeaves[j].score = 4; popupLeaves[j].score = 4;
@ -2232,7 +2222,6 @@ void UpdateGameplayScreen(void)
player.x -= speed; player.x -= speed;
grabCounter += 1*TIME_FACTOR; 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++) for (int i = 0; i < MAX_ENEMIES; i++)
{ {
if (CheckCollisionRecs(player, snake[i]) && !isHitSnake[i] && snakeActive[i]) if (CheckCollisionRecs(player, snake[i]) && !isHitSnake[i] && snakeActive[i])
@ -2286,7 +2275,6 @@ void UpdateGameplayScreen(void)
enemyHit[i].speed = (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].size = (float)GetRandomValue(5, 10)/30;
enemyHit[i].rotation = 0.0f; 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].alpha = 1.0f;
enemyHit[i].active = true; enemyHit[i].active = true;
@ -2317,7 +2305,6 @@ void UpdateGameplayScreen(void)
enemyHit[i].speed = (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].size = (float)GetRandomValue(5, 10)/30;
enemyHit[i].rotation = 0.0f; 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].alpha = 1.0f;
enemyHit[i].active = true; enemyHit[i].active = true;
@ -2392,9 +2379,7 @@ void UpdateGameplayScreen(void)
thisFrameKoala = 0; thisFrameKoala = 0;
} }
//if (curFrameKoala > 1) curFrameKoala = ; if (curFrameKoala <= 1) koalaAnimationTransform.x = gameplay_koala_transform.x + koalaAnimationTransform.width*curFrameKoala;
if(curFrameKoala <= 1 )koalaAnimationTransform.x = gameplay_koala_transform.x + koalaAnimationTransform.width*curFrameKoala;
if (transAniCounter >= 5) if (transAniCounter >= 5)
{ {
@ -2407,8 +2392,7 @@ void UpdateGameplayScreen(void)
finalColor = RED; finalColor = RED;
finalColor2 = WHITE; finalColor2 = WHITE;
} }
else
if (!transBackAnim)
{ {
finalColor = WHITE; finalColor = WHITE;
finalColor2 = RED; finalColor2 = RED;
@ -2420,9 +2404,7 @@ void UpdateGameplayScreen(void)
thisFrameKoala = 0; thisFrameKoala = 0;
curFrameKoala = 0; curFrameKoala = 0;
speedFX.active = true; speedFX.active = true;
//speedMod = 2;
transCount = 0; transCount = 0;
//printf ("THIS ISN'T EVEN MY FINAL FORM");
bambooTimer += 15*TIME_FACTOR; bambooTimer += 15*TIME_FACTOR;
} }
} }
@ -2558,7 +2540,7 @@ void UpdateGameplayScreen(void)
velocity -= 1*TIME_FACTOR; velocity -= 1*TIME_FACTOR;
player.y -= velocity; player.y -= velocity;
if(player.y >= GetScreenHeight()) if (player.y >= GetScreenHeight())
{ {
deathsCounter++; deathsCounter++;
finishScreen = 1; finishScreen = 1;
@ -2781,7 +2763,7 @@ void DrawGameplayScreen(void)
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 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: 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); 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); 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; } break;
@ -3781,7 +3763,7 @@ static void Reset(void)
bamboo[i].y = 0; bamboo[i].y = 0;
bamboo[i].width = 50; bamboo[i].width = 50;
bamboo[i].height = GetScreenHeight(); bamboo[i].height = GetScreenHeight();
if(i > 5) bambooActive[i] = false; if (i > 5) bambooActive[i] = false;
else bambooActive[i] = true; else bambooActive[i] = true;
} }

View file

@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

View file

@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

View file

@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

View file

@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

View file

@ -236,7 +236,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# Define a custom shell .html and output extension # Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)\src\shell.html CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html EXT = .html
endif endif

Some files were not shown because too many files have changed in this diff Show more