Browse Source

Review games

Ray 6 năm trước cách đây
mục cha
commit
477f05db13

+ 6 - 6
games/cat_vs_roomba/roomba.c

@@ -1,14 +1,14 @@
 /*******************************************************************************************
 *
-*   raylib - Advance Game template
+*   CAT VS ROOMBA [GLOBAL GAME JAM 2019]
 *
-*   <Game title>
-*   <Game description>
+*   Ah! Home, sweet home! Time for some automatic cleaning... 
+*   if the worst enemy of Roomba allows it... be careful with Cat!
 *
-*   This game has been created using raylib (www.raylib.com)
+*   This game has been created using raylib 2.0 (www.raylib.com)
 *   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
 *
-*   Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2019 Ramon Santamaria (@raysan5)
 *
 ********************************************************************************************/
 
@@ -57,7 +57,7 @@ int main(void)
 {
     // Initialization (Note windowTitle is unused on Android)
     //---------------------------------------------------------
-    InitWindow(screenWidth, screenHeight, "raylib template - advance game");
+    InitWindow(screenWidth, screenHeight, "CAT VS ROOMBA [GGJ19]");
 
     // Global data loading (assets that must be available in all screens, i.e. fonts)
     InitAudioDevice();

+ 11 - 11
games/cat_vs_roomba/screens/screen_logo.c

@@ -33,22 +33,22 @@
 //----------------------------------------------------------------------------------
 
 // Logo screen global variables
-static int framesCounter;
-static int finishScreen;
+static int framesCounter = 0;
+static int finishScreen = 0;
 
-static int logoPositionX;
-static int logoPositionY;
+static int logoPositionX = 0;
+static int logoPositionY = 0;
 
-static int lettersCount;
+static int lettersCount = 0;
 
-static int topSideRecWidth;
-static int leftSideRecHeight;
+static int topSideRecWidth = 0;
+static int leftSideRecHeight = 0;
 
-static int bottomSideRecWidth;
-static int rightSideRecHeight;
+static int bottomSideRecWidth = 0;
+static int rightSideRecHeight = 0;
 
-static char raylib[8];          // raylib text array, max 8 letters
-static int state;               // Tracking animation states (State Machine)
+static char raylib[8] = { 0 };  // raylib text array, max 8 letters
+static int state = 0;           // Tracking animation states (State Machine)
 static float alpha = 1.0f;      // Useful for fading
 
 //----------------------------------------------------------------------------------

+ 8 - 12
games/just_do/just_do.c

@@ -1,20 +1,19 @@
 /*******************************************************************************************
 *
-*   JUST DO - Global Game Jam 2015 Videogame
-*   Experimental puzzle game that lets the user try to find a logic solution to 
-*   different shape-color-based situations.
+*   JUST DO [GLOBAL GAME JAM 2015]
 *
-*   Developed by: Ramon Santamaria (Ray San)
+*   Experimental puzzle game that lets the user try to find a logic 
+*   solution to different shape-color-based situations.
 *
 *   This game has been created using raylib 1.6 (www.raylib.com)
 *   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
 *
-*   raylib - Copyright (c) 2015 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2015 Ramon Santamaria (@raysan5)
 *
 ********************************************************************************************/
 
 #include "raylib.h"
-#include "screens/screens.h"    // NOTE: Defines currentScreen
+#include "screens/screens.h"    // NOTE: Defines global variable: currentScreen
 
 #if defined(PLATFORM_WEB)
     #include <emscripten/emscripten.h>
@@ -53,7 +52,7 @@ int main(void)
 {
 	// Initialization (Note windowTitle is unused on Android)
 	//---------------------------------------------------------
-    InitWindow(screenWidth, screenHeight, "GGJ15 - JUST DO");
+    InitWindow(screenWidth, screenHeight, "JUST DO [GGJ15]");
 
     // Load global data here (assets that must be available in all screens, i.e. fonts)
     InitAudioDevice();
@@ -74,9 +73,6 @@ int main(void)
     // Main game loop
     while (!WindowShouldClose())    // Detect window close button or ESC key
     {
-                
-        if (IsKeyPressed(KEY_SPACE)) PlaySound(levelWin);
-        
         UpdateDrawFrame();
     }
 #endif
@@ -144,6 +140,8 @@ void UpdateDrawFrame(void)
 {
     // Update
     //----------------------------------------------------------------------------------
+    if (currentScreen != LOGO) UpdateMusicStream(music);
+    
     if (!onTransition)
     {
         if (IsKeyPressed('0'))
@@ -197,8 +195,6 @@ void UpdateDrawFrame(void)
             InitLevel08Screen();
         }
         
-        UpdateMusicStream(music);
-        
         switch(currentScreen) 
         {
             case LOGO: 

+ 9 - 12
games/koala_seasons/koala_seasons.c

@@ -1,6 +1,6 @@
 /*******************************************************************************************
 *
-*   raylib - Koala Seasons game
+*   Koala Seasons [emegeme 2015]
 *
 *   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?
@@ -13,7 +13,7 @@
 ********************************************************************************************/
 
 #include "raylib.h"
-#include "screens/screens.h"    // NOTE: Defines currentScreen
+#include "screens/screens.h"    // NOTE: Defines global variable: currentScreen
 
 #if defined(PLATFORM_WEB)
     #include <emscripten/emscripten.h>
@@ -22,6 +22,9 @@
 //----------------------------------------------------------------------------------
 // Global Variables Definition (local to this module)
 //----------------------------------------------------------------------------------
+static const int screenWidth = 1280;
+static const int screenHeight = 720;
+
 static float transAlpha = 0;
 static bool onTransition = false;
 static bool transFadeOut = false;
@@ -43,17 +46,11 @@ void UpdateDrawFrame(void);     // Update and Draw one frame
 //----------------------------------------------------------------------------------
 // Main entry point
 //----------------------------------------------------------------------------------
-int main(void) {
-	// Initialization
+int main(void) 
+{
+	// Initialization (Note windowTitle is unused on Android)
 	//---------------------------------------------------------
-    const int screenWidth = 1280;
-    const int screenHeight = 720;
-	const char windowTitle[30] = "KOALA SEASONS";
-    
-    //SetConfigFlags(FLAG_FULLSCREEN_MODE);
-    
-    // Note that windowTitle is ignored on Android
-    InitWindow(screenWidth, screenHeight, windowTitle);
+    InitWindow(screenWidth, screenHeight, "KOALA SEASONS");
 
     // Load global data here (assets that must be available in all screens, i.e. fonts)
     font = LoadFont("resources/graphics/mainfont.png");

+ 4 - 4
games/light_my_ritual/light_my_ritual.c

@@ -1,16 +1,16 @@
 /*******************************************************************************************
 *
-*   GLOBAL GAME JAM 2016 - LIGHT MY RITUAL!
+*   LIGHT MY RITUAL [GLOBAL GAME JAM 2016]
 *
 *   Preparing a ritual session is not that easy. 
 *   You must light all the candles before the astral alignment finishes... 
 *   but dark creatures move in the shadows to put out all your lights! 
 *   Be fast! Be smart! Light my ritual!
 *
-*   This game has been created using raylib (www.raylib.com)
+*   This game has been created using raylib 1.6 (www.raylib.com)
 *   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
 *
-*   Copyright (c) 2015 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2016 Ramon Santamaria (@raysan5)
 *
 ********************************************************************************************/
 
@@ -55,7 +55,7 @@ int main(void)
 {
 	// Initialization (Note windowTitle is unused on Android)
 	//---------------------------------------------------------
-    InitWindow(screenWidth, screenHeight, "GGJ16 - LIGHT MY RITUAL!");
+    InitWindow(screenWidth, screenHeight, "LIGHT MY RITUAL! [GGJ16]");
 
     // Global data loading (assets that must be available in all screens, i.e. fonts)
     InitAudioDevice();

+ 4 - 2
games/skully_escape/skully_escape.c

@@ -2,10 +2,12 @@
 *
 *   SKULLY ESCAPE [KING GAME JAM 2015]
 *
+*   A scary graphic adventure in an old mansion
+*
 *   This game has been created using raylib 1.6 (www.raylib.com)
 *   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
 *
-*   Copyright (c) 2014 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2015 Ramon Santamaria (@raysan5)
 *
 ********************************************************************************************/
 
@@ -52,7 +54,7 @@ int main(void)
 {
 	// Initialization (Note windowTitle is unused on Android)
 	//---------------------------------------------------------
-    InitWindow(screenWidth, screenHeight, "SKULLY ESCAPE [KING GAMEJAM]");
+    InitWindow(screenWidth, screenHeight, "SKULLY ESCAPE [KING GAMEJAM 2015]");
 
     // Global data loading (assets that must be available in all screens, i.e. fonts)
     InitAudioDevice();

+ 1 - 1
games/transmission/screens/screen_ending.c

@@ -222,7 +222,7 @@ static char *StringReplace(char *orig, char *rep, char *with)
 
     // Count the number of replacements needed
     ins = orig;
-    for (count = 0; tmp = strstr(ins, rep); ++count)
+    for (count = 0; (tmp = strstr(ins, rep)); ++count)
     {
         ins = tmp + len_rep;
     }

+ 172 - 29
games/transmission/screens/screen_logo.c

@@ -26,19 +26,32 @@
 #include "raylib.h"
 #include "screens.h"
 
+#define LOGO_RECS_SIDE  16
+
 //----------------------------------------------------------------------------------
 // Global Variables Definition (local to this module)
 //----------------------------------------------------------------------------------
 
 // Logo screen global variables
-static int framesCounter;
-static int finishScreen;
+static int framesCounter = 0;
+static int finishScreen = 0;
+
+static int logoPositionX = 0;
+static int logoPositionY = 0;
+
+static int lettersCount = 0;
+
+static int topSideRecWidth = 0;
+static int leftSideRecHeight = 0;
 
-static Texture2D logoCW;
+static int bottomSideRecWidth = 0;
+static int rightSideRecHeight = 0;
 
-static float fadeValue;
-static int showLogoFrames;
-static bool fadeOut;
+static char raylib[8] = { 0 };          // raylib text array, max 8 letters
+static int state = 0;                   // Tracking animation states (State Machine)
+static float alpha = 1.0f;              // Useful for fading
+
+static Texture2D texLogoCW = { 0 };     // Cinamon Works texture
 
 //----------------------------------------------------------------------------------
 // Logo Screen Functions Definition
@@ -47,53 +60,183 @@ static bool fadeOut;
 // Logo Screen Initialization logic
 void InitLogoScreen(void)
 {
-    framesCounter = 0;
+    // Initialize LOGO screen variables here!
     finishScreen = 0;
+    framesCounter = 0;
+    lettersCount = 0;
+    
+    logoPositionX = GetScreenWidth()/2 - 128;
+    logoPositionY = GetScreenHeight()/2 - 128;
     
-    logoCW = LoadTexture("resources/textures/cw_logo.png");
+    topSideRecWidth = LOGO_RECS_SIDE;
+    leftSideRecHeight = LOGO_RECS_SIDE;
+    bottomSideRecWidth = LOGO_RECS_SIDE;
+    rightSideRecHeight = LOGO_RECS_SIDE;
     
-    showLogoFrames = 60;
-    fadeValue = 0;
+    for (int i = 0; i < 8; i++) raylib[i] = '\0';
     
-    fadeOut = false;
+    state = 0;
+    alpha = 1.0f;
+
+    texLogoCW = LoadTexture("resources/textures/cw_logo.png");
 }
 
 // Logo Screen Update logic
 void UpdateLogoScreen(void)
 {
-    if (!fadeOut)
-    {       
-        fadeValue += 0.02f;
-        if (fadeValue > 1.01f)
+    // Update LOGO screen variables here!
+    if (state == 0)                 // State 0: Small box blinking
+    {
+        framesCounter++;
+
+        if (framesCounter == 80)
+        {
+            state = 1;
+            framesCounter = 0;      // Reset counter... will be used later...
+        }
+    }
+    else if (state == 1)            // State 1: Top and left bars growing
+    {
+        topSideRecWidth += 8;
+        leftSideRecHeight += 8;
+
+        if (topSideRecWidth == 256) state = 2;
+    }
+    else if (state == 2)            // State 2: Bottom and right bars growing
+    {
+        bottomSideRecWidth += 8;
+        rightSideRecHeight += 8;
+
+        if (bottomSideRecWidth == 256) state = 3;
+    }
+    else if (state == 3)            // State 3: Letters appearing (one by one)
+    {
+        framesCounter++;
+
+        if (framesCounter/10)       // Every 12 frames, one more letter!
+        {
+            lettersCount++;
+            framesCounter = 0;
+        }
+
+        switch (lettersCount)
         {
-            fadeValue = 1.0f;
-            framesCounter++;
-            
-            if ((framesCounter%showLogoFrames) == 0)
+            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;
+        }
+
+        // When all letters have appeared...
+        if (lettersCount >= 10)
+        {
+            state = 4;
+            framesCounter = 0;
+        }
+    }
+    else if (state == 4)
+    {
+        framesCounter++;
+        
+        if (framesCounter > 100)
+        {
+            alpha -= 0.02f;
+
+            if (alpha <= 0.0f)
             {
-                fadeOut = true;
-                finishScreen = true;
-            }  
-        }        
-    }   
-    
-    if (IsKeyPressed(KEY_ENTER)) finishScreen = true;
+                alpha = 0.0f;
+                framesCounter = 0;
+                state = 5;
+            }
+        }
+    }
+    else if (state == 5)
+    {
+        alpha += 0.02f;
+        if (alpha >= 1.0f) alpha = 1.0f;
+        
+        framesCounter++;
+        if (framesCounter > 200)
+        {
+            framesCounter = 0;
+            state = 6;
+        }
+    }
+    else if (state == 6)
+    {
+        alpha -= 0.02f;
+        if (alpha >= 1.0f) alpha = 1.0f;
+        
+        framesCounter++;
+        if (framesCounter > 100)
+        {
+            framesCounter = 0;
+            finishScreen = 1;
+        }
+    }
 }
 
 // Logo Screen Draw logic
 void DrawLogoScreen(void)
 {
-    DrawTexture(logoCW, GetScreenWidth()/2 - logoCW.width/2, GetScreenHeight()/2 - logoCW.height/2, Fade(WHITE, fadeValue));
+    if (state == 0)
+    {
+        if ((framesCounter/10)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK);
+    }
+    else if (state == 1)
+    {
+        DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
+        DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
+    }
+    else if (state == 2)
+    {
+        DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
+        DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
+
+        DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK);
+        DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK);
+    }
+    else if (state == 3)
+    {
+        DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha));
+        DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha));
+
+        DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha));
+        DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha));
+
+        DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, Fade(RAYWHITE, alpha));
+
+        DrawText(raylib, GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha));
+    }
+    else if (state == 4)
+    {
+        DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha));
+        DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha));
+
+        DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha));
+        DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha));
+
+        DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, Fade(RAYWHITE, alpha));
+
+        DrawText(raylib, GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha));
+        
+        if (framesCounter > 20) DrawText("powered by", logoPositionX, logoPositionY - 27, 20, Fade(DARKGRAY, alpha));
+    }
+    else if ((state == 5) || (state == 6)) DrawTexture(texLogoCW, GetScreenWidth()/2 - texLogoCW.width/2, GetScreenHeight()/2 - texLogoCW.height/2, Fade(WHITE, alpha));
 }
 
 // Logo Screen Unload logic
 void UnloadLogoScreen(void)
 {
-    UnloadTexture(logoCW);
+    // Unload LOGO screen variables here!
+    UnloadTexture(texLogoCW);
 }
 
 // Logo Screen should finish?
 int FinishLogoScreen(void)
 {
     return finishScreen;
-}
+}

+ 7 - 10
games/transmission/transmission.c

@@ -1,13 +1,14 @@
 /*******************************************************************************************
 *
-*   raylib - transmission mission
+*   TRANSMISSION MISSION [GLOBAL GAME JAM 2018]
 *
-*   Code and transmit the right message
+*   Code the different filtration messages to be send to newspaper 
+*   to avoid being understood in case of interception. 
 *
-*   This game has been created using raylib (www.raylib.com)
+*   This game has been created using raylib 1.8 (www.raylib.com)
 *   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
 *
-*   Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2018 Ramon Santamaria (@raysan5)
 *
 ********************************************************************************************/
 
@@ -53,13 +54,9 @@ static void UpdateDrawFrame(void);          // Update and Draw one frame
 //----------------------------------------------------------------------------------
 int main(void)
 {
-    // Initialization
+    // Initialization (Note windowTitle is unused on Android)
     //---------------------------------------------------------
-#ifndef PLATFORM_ANDROID
-    SetConfigFlags(FLAG_SHOW_LOGO); // | FLAG_FULLSCREEN_MODE);
-#endif
-    // Note windowTitle is unused on Android
-    InitWindow(screenWidth, screenHeight, "raylib game - transmission mission");
+    InitWindow(screenWidth, screenHeight, "transmission mission [GGJ18]");
 
     // Global data loading (assets that must be available in all screens, i.e. fonts)
     InitAudioDevice();

+ 2 - 2
games/wave_collector/wave_collector.c

@@ -1,6 +1,6 @@
 /*******************************************************************************************
 *
-*   GLOBAL GAME JAM 2017 - WAVE COLLECTOR
+*   WAVE COLLECTOR [GLOBAL GAME JAM 2017]
 *
 *   The ultimate wave particles collector is here!
 *   You must follow the wave and collect all the particles 
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
     SetConfigFlags(FLAG_MSAA_4X_HINT);
 #endif
     // Note windowTitle is unused on Android
-    InitWindow(screenWidth, screenHeight, "GGJ17 - WAVE COLLECTOR");
+    InitWindow(screenWidth, screenHeight, "WAVE COLLECTOR [GGJ17]");
 
     // Global data loading (assets that must be available in all screens, i.e. fonts)
     InitAudioDevice();