You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1065 regels
52 KiB

  1. /**********************************************************************************************
  2. *
  3. * raylib - Koala Seasons game
  4. *
  5. * Title Screen Functions Definitions (Init, Update, Draw, Unload)
  6. *
  7. * Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
  8. *
  9. * This software is provided "as-is", without any express or implied warranty. In no event
  10. * will the authors be held liable for any damages arising from the use of this software.
  11. *
  12. * Permission is granted to anyone to use this software for any purpose, including commercial
  13. * applications, and to alter it and redistribute it freely, subject to the following restrictions:
  14. *
  15. * 1. The origin of this software must not be misrepresented; you must not claim that you
  16. * wrote the original software. If you use this software in a product, an acknowledgment
  17. * in the product documentation would be appreciated but is not required.
  18. *
  19. * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
  20. * as being the original software.
  21. *
  22. * 3. This notice may not be removed or altered from any source distribution.
  23. *
  24. **********************************************************************************************/
  25. #include "raylib.h"
  26. #include "screens.h"
  27. #include <math.h>
  28. #include "atlas01.h"
  29. #include "atlas02.h"
  30. #define MAX_DURATION 120
  31. #define MAX_particle 128
  32. //----------------------------------------------------------------------------------
  33. // Global Variables Definition (local to this module)
  34. //----------------------------------------------------------------------------------
  35. typedef struct {
  36. Vector2 position;
  37. Vector2 speed;
  38. float rotation;
  39. float size;
  40. Color color;
  41. float alpha;
  42. float rotPhy;
  43. bool active;
  44. } Particle;
  45. typedef struct {
  46. Vector2 position;
  47. Color color;
  48. float alpha;
  49. float size;
  50. float rotation;
  51. bool active; // NOTE: Use it to activate/deactive particle
  52. bool fading;
  53. float delayCounter;
  54. } RayParticleTitle;
  55. typedef struct {
  56. Vector2 position;
  57. bool active;
  58. int spawnTime;
  59. int maxTime;
  60. Particle particle[1024];
  61. } Stormparticleystem;
  62. typedef struct {
  63. Vector2 position;
  64. bool active;
  65. int spawnTime;
  66. int maxTime;
  67. Particle particle[MAX_particle];
  68. } particleystemTitle;
  69. typedef struct {
  70. Vector2 position;
  71. bool active;
  72. int spawnTime;
  73. int maxTime;
  74. RayParticleTitle particle[20];
  75. } RayparticleystemTitle;
  76. // Title screen global variables
  77. static int framesCounter;
  78. static int finishScreen;
  79. static int globalFrameCounter;
  80. static int currentFrame;
  81. static int thisFrame;
  82. static int parallaxBackOffset;
  83. static int parallaxFrontOffset;
  84. static float currentValue1;
  85. static float currentValue2;
  86. static float initValue1;
  87. static float initValue2;
  88. static float finishValue1;
  89. static float finishValue2;
  90. static float duration;
  91. static Vector2 fontSize;
  92. static bool soundActive;
  93. static bool musicActive;
  94. static Rectangle koalaMenu;
  95. static Rectangle bamboo[5];
  96. static Rectangle player = {0, 0, 0, 0};
  97. static Rectangle soundButton;
  98. static Rectangle speakerButton;
  99. static Color color00, color01, color02, color03;
  100. static particleystemTitle snowParticle;
  101. static particleystemTitle backSnowParticle;
  102. static particleystemTitle dandelionParticle;
  103. static particleystemTitle dandelionBackParticle;
  104. static particleystemTitle planetreeParticle;
  105. static particleystemTitle backPlanetreeParticle;
  106. static particleystemTitle flowerParticle;
  107. static particleystemTitle backFlowerParticle;
  108. static particleystemTitle rainParticle;
  109. static particleystemTitle backRainParticle;
  110. static RayparticleystemTitle rayparticle;
  111. static RayparticleystemTitle backRayparticle;
  112. static Stormparticleystem rainStormParticle;
  113. static Stormparticleystem snowStormParticle;
  114. const char pressToPlay[16] = "Press to play";
  115. //----------------------------------------------------------------------------------
  116. // Title Screen Functions Definition
  117. //----------------------------------------------------------------------------------
  118. static void DrawParallaxFront(void);
  119. static void DrawParallaxMiddle(void);
  120. static void DrawParallaxBack(void);
  121. static float BounceEaseOut(float t,float b , float c, float d);
  122. // Title Screen Initialization logic
  123. void InitTitleScreen(void)
  124. {
  125. framesCounter = 0;
  126. finishScreen = 0;
  127. initValue1 = -100;
  128. finishValue1 = 100;
  129. initValue2 = 700;
  130. finishValue2 = finishValue1 + 220;
  131. duration = MAX_DURATION;
  132. initSeason = GetRandomValue(0, 3);
  133. soundActive = true;
  134. musicActive = true;
  135. parallaxBackOffset = GetRandomValue(10, 100);
  136. parallaxFrontOffset = GetRandomValue(100, 200);
  137. rainChance = GetRandomValue(0, 100);
  138. snowParticle.position = (Vector2){ 0, 0 };
  139. snowParticle.active = false;
  140. backSnowParticle.position = (Vector2){ 0, 0 };
  141. backSnowParticle.active = false;
  142. planetreeParticle.position = (Vector2){ 0, 0 };
  143. planetreeParticle.active = false;
  144. backPlanetreeParticle.position = (Vector2){ 0, 0 };
  145. backPlanetreeParticle.active = false;
  146. dandelionParticle.active = false;
  147. dandelionBackParticle.position = (Vector2){ 0, 0};
  148. flowerParticle.position = (Vector2){ 0, 0 };
  149. flowerParticle.active = false;
  150. backFlowerParticle.position = (Vector2){ 0, 0 };
  151. backFlowerParticle.active = false;
  152. rayparticle.position = (Vector2){ 0, 0 };
  153. rayparticle.active = false;
  154. backRayparticle.position = (Vector2){ 0, 0 };
  155. backRayparticle.active = false;
  156. rainStormParticle.position = (Vector2){ 0, 0 };
  157. rainStormParticle.active = false;
  158. snowStormParticle.position = (Vector2){ 0, 0 };
  159. snowStormParticle.active = false;
  160. soundButton = (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.7, title_music_on.width, title_music_on.height };
  161. speakerButton = (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.85, title_speaker_on.width, title_speaker_on.height };
  162. for (int j = 0; j < MAX_particle; j++)
  163. {
  164. snowParticle.particle[j].active = false;
  165. snowParticle.particle[j].position = (Vector2){ 0, 0 };
  166. snowParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
  167. snowParticle.particle[j].rotation = GetRandomValue(0, 360);
  168. snowParticle.particle[j].color = WHITE;
  169. snowParticle.particle[j].alpha = 1.0f;
  170. backSnowParticle.particle[j].active = false;
  171. backSnowParticle.particle[j].position = (Vector2){ 0, 0 };
  172. backSnowParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
  173. backSnowParticle.particle[j].rotation = GetRandomValue(0, 360);
  174. backSnowParticle.particle[j].color = WHITE;
  175. backSnowParticle.particle[j].alpha = 0.7f;
  176. planetreeParticle.particle[j].active = false;
  177. planetreeParticle.particle[j].position = (Vector2){ 0, 0 };
  178. planetreeParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
  179. planetreeParticle.particle[j].rotation = GetRandomValue(0, 360);
  180. planetreeParticle.particle[j].color = WHITE;
  181. planetreeParticle.particle[j].alpha = 1.0f;
  182. backPlanetreeParticle.particle[j].active = false;
  183. backPlanetreeParticle.particle[j].position = (Vector2){ 0, 0 };
  184. backPlanetreeParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
  185. backPlanetreeParticle.particle[j].rotation = GetRandomValue(0, 360);
  186. backPlanetreeParticle.particle[j].color = WHITE;
  187. backPlanetreeParticle.particle[j].alpha = 0.7f;
  188. dandelionParticle.particle[j].active = false;
  189. dandelionParticle.particle[j].position = (Vector2){ 0, 0 };
  190. dandelionParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
  191. dandelionParticle.particle[j].rotation = 0;
  192. dandelionParticle.particle[j].color = WHITE;
  193. dandelionParticle.particle[j].alpha = 1;
  194. dandelionParticle.particle[j].rotPhy = GetRandomValue(0 , 180);
  195. dandelionBackParticle.particle[j].active = false;
  196. dandelionBackParticle.particle[j].position = (Vector2){ 0, 0 };
  197. dandelionBackParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
  198. dandelionBackParticle.particle[j].rotation = 0;
  199. dandelionBackParticle.particle[j].color = WHITE;
  200. dandelionBackParticle.particle[j].alpha = 0.7f;
  201. dandelionBackParticle.particle[j].rotPhy = GetRandomValue(0 , 180);
  202. flowerParticle.particle[j].active = false;
  203. flowerParticle.particle[j].position = (Vector2){ 0, 0 };
  204. flowerParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
  205. flowerParticle.particle[j].rotation = GetRandomValue(0, 360);
  206. flowerParticle.particle[j].color = WHITE;
  207. flowerParticle.particle[j].alpha = 1.0f;
  208. backFlowerParticle.particle[j].active = false;
  209. backFlowerParticle.particle[j].position = (Vector2){ 0, 0 };
  210. backFlowerParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
  211. backFlowerParticle.particle[j].rotation = GetRandomValue(0, 360);
  212. backFlowerParticle.particle[j].color = WHITE;
  213. backFlowerParticle.particle[j].alpha = 0.7f;
  214. rainParticle.particle[j].active = false;
  215. rainParticle.particle[j].position = (Vector2){ 0, 0 };
  216. rainParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
  217. rainParticle.particle[j].rotation = -20;
  218. rainParticle.particle[j].color = WHITE;
  219. rainParticle.particle[j].alpha = 1.0f;
  220. backRainParticle.particle[j].active = false;
  221. backRainParticle.particle[j].position = (Vector2){ 0, 0 };
  222. backRainParticle.particle[j].size = (float)GetRandomValue(2, 8)/10;
  223. backRainParticle.particle[j].rotation = -20;
  224. backRainParticle.particle[j].color = WHITE;
  225. backRainParticle.particle[j].alpha = 0.7f;
  226. }
  227. for (int j = 0; j < 1024; j++)
  228. {
  229. rainStormParticle.particle[j].active = false;
  230. rainStormParticle.particle[j].position = (Vector2){ 0, 0 };
  231. rainStormParticle.particle[j].size = (float)GetRandomValue(3, 9)/10;
  232. rainStormParticle.particle[j].rotation = -40;
  233. rainStormParticle.particle[j].color = WHITE;
  234. rainStormParticle.particle[j].alpha = 1.0f;
  235. }
  236. for (int j = 0; j < 256; j++)
  237. {
  238. snowStormParticle.particle[j].active = false;
  239. snowStormParticle.particle[j].position = (Vector2){ 0, 0 };
  240. snowStormParticle.particle[j].size = (float)GetRandomValue(4, 8)/10;
  241. snowStormParticle.particle[j].rotation = 40;
  242. snowStormParticle.particle[j].color = WHITE;
  243. snowStormParticle.particle[j].alpha = 1.0f;
  244. }
  245. for (int i = 0; i < 20; i++)
  246. {
  247. rayparticle.particle[i].position = (Vector2){ 0, 0 };
  248. rayparticle.particle[i].color.r = 255;
  249. rayparticle.particle[i].color.g = 255;
  250. rayparticle.particle[i].color.b = 182;
  251. rayparticle.particle[i].color.a = 255;
  252. rayparticle.particle[i].alpha = 0.0f;
  253. rayparticle.particle[i].size = (float)GetRandomValue(15, 20)/10;
  254. rayparticle.particle[i].rotation = 0.0f;
  255. rayparticle.particle[i].active = false;
  256. rayparticle.particle[i].fading = false;
  257. rayparticle.particle[i].delayCounter = 0;
  258. backRayparticle.particle[i].position = (Vector2){ 0, 0 };
  259. backRayparticle.particle[i].color.r = 255;
  260. backRayparticle.particle[i].color.g = 255;
  261. backRayparticle.particle[i].color.b = 182;
  262. backRayparticle.particle[i].color.a = 255;
  263. backRayparticle.particle[i].alpha = 0.0f;
  264. backRayparticle.particle[i].size = (float)GetRandomValue(5, 10)/10;
  265. backRayparticle.particle[i].rotation = 0.0f;
  266. backRayparticle.particle[i].active = false;
  267. backRayparticle.particle[i].fading = false;
  268. backRayparticle.particle[i].delayCounter = 0;
  269. }
  270. for (int i = 0; i < 5; i++)
  271. {
  272. bamboo[i].x = 150 + 200*i;
  273. bamboo[i].y = 0;
  274. bamboo[i].width = 30;
  275. bamboo[i].height = GetScreenHeight();
  276. }
  277. player.x = 350;
  278. player.y = 100;
  279. player.width = 35;
  280. player.height = 60;
  281. koalaMenu.x = gameplay_koala_menu.x;
  282. koalaMenu.y = gameplay_koala_menu.y;
  283. koalaMenu.width = gameplay_koala_menu.width/2;
  284. koalaMenu.height = gameplay_koala_menu.height;
  285. fontSize = MeasureTextEx(font, "PRESS TO PLAY", font.baseSize, 2);
  286. }
  287. // Title Screen Update logic
  288. void UpdateTitleScreen(void)
  289. {
  290. framesCounter += 1*TIME_FACTOR;
  291. globalFrameCounter += 1*TIME_FACTOR;
  292. if (framesCounter < duration)
  293. {
  294. currentValue1 = BounceEaseOut((float)framesCounter, initValue1, (finishValue1 - initValue1), duration);
  295. currentValue2 = BounceEaseOut((float)framesCounter, initValue2, (finishValue2 - initValue2), duration);
  296. }
  297. thisFrame += 1*TIME_FACTOR;
  298. if (thisFrame >= 40)
  299. {
  300. currentFrame++;
  301. thisFrame = 0;
  302. }
  303. if (currentFrame > 1) currentFrame = 0;
  304. koalaMenu.x = gameplay_koala_menu.x + koalaMenu.width*currentFrame;
  305. if (initSeason == 0)
  306. {
  307. dandelionParticle.active = true;
  308. dandelionBackParticle.active = true;
  309. rayparticle.active = true;
  310. backRayparticle.active = true;
  311. rainParticle.active = false;
  312. rainStormParticle.active = false;
  313. backRainParticle.active = false;
  314. color00 = (Color){129, 172, 86, 255}; // Summer Color
  315. color01 = (Color){145, 165, 125, 255};
  316. color02 = (Color){161, 130, 73, 255};
  317. color03 = (Color){198, 103, 51, 255};
  318. }
  319. else if (initSeason == 1)
  320. {
  321. if (rainChance > 40)
  322. {
  323. planetreeParticle.active = true;
  324. backPlanetreeParticle.active = true;
  325. rainParticle.active = false;
  326. backRainParticle.active = false;
  327. }
  328. else if (rainChance <= 40 && rainChance > 15)
  329. {
  330. rainStormParticle.active = true;
  331. backRainParticle.active = false;
  332. }
  333. else if (rainChance <= 15)
  334. {
  335. rainStormParticle.active = true;
  336. backRainParticle.active = false;
  337. }
  338. color00 = (Color){242, 113, 62, 255}; // Fall Color
  339. color01 = (Color){190, 135, 114, 255};
  340. color02 = (Color){144, 130, 101, 255};
  341. color03 = (Color){214, 133, 58, 255};
  342. }
  343. else if (initSeason == 2)
  344. {
  345. if (rainChance > 40)
  346. {
  347. snowParticle.active = true;
  348. backSnowParticle.active = true;
  349. }
  350. else
  351. {
  352. snowStormParticle.active = true;
  353. backSnowParticle.active = true;
  354. }
  355. rainParticle.active = false;
  356. rainStormParticle.active = false;
  357. backRainParticle.active = false;
  358. color00 = (Color){130, 130, 181, 255}; // Winter Color
  359. color01 = (Color){145, 145, 166, 255};
  360. color02 = (Color){104, 142, 144, 255};
  361. color03 = (Color){57, 140, 173, 255};
  362. }
  363. else if (initSeason == 3)
  364. {
  365. flowerParticle.active = true;
  366. backFlowerParticle.active = true;
  367. rainParticle.active = false;
  368. rainStormParticle.active = false;
  369. backRainParticle.active = false;
  370. color00 = (Color){196, 176, 49, 255}; // Spring Color
  371. color01 = (Color){178, 163, 67, 255};
  372. color02 = (Color){133, 143, 90, 255};
  373. color03 = (Color){133, 156, 42, 255};
  374. }
  375. // Snow Particle
  376. if (snowParticle.active)
  377. {
  378. snowParticle.spawnTime += 1*TIME_FACTOR;
  379. for (int i = 0; i < MAX_particle; i++)
  380. {
  381. if (!snowParticle.particle[i].active && snowParticle.spawnTime >= snowParticle.maxTime)
  382. {
  383. snowParticle.particle[i].active = true;
  384. snowParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  385. snowParticle.spawnTime = 0;
  386. snowParticle.maxTime = GetRandomValue (5, 20);
  387. }
  388. }
  389. }
  390. if (backSnowParticle.active)
  391. {
  392. backSnowParticle.spawnTime += 1*TIME_FACTOR;
  393. for (int i = 0; i < MAX_particle; i++)
  394. {
  395. if (!backSnowParticle.particle[i].active && backSnowParticle.spawnTime >= backSnowParticle.maxTime)
  396. {
  397. backSnowParticle.particle[i].active = true;
  398. backSnowParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  399. backSnowParticle.spawnTime = 0;
  400. backSnowParticle.maxTime = GetRandomValue (3, 10);
  401. }
  402. }
  403. }
  404. // Autumn leaves particle
  405. if (planetreeParticle.active)
  406. {
  407. planetreeParticle.spawnTime += 1*TIME_FACTOR;
  408. backPlanetreeParticle.spawnTime += 1*TIME_FACTOR;
  409. for (int i = 0; i < MAX_particle; i++)
  410. {
  411. if (!planetreeParticle.particle[i].active && planetreeParticle.spawnTime >= planetreeParticle.maxTime)
  412. {
  413. planetreeParticle.particle[i].active = true;
  414. planetreeParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  415. planetreeParticle.spawnTime = 0;
  416. planetreeParticle.maxTime = GetRandomValue (5, 20);
  417. }
  418. if (!backPlanetreeParticle.particle[i].active && backPlanetreeParticle.spawnTime >= backPlanetreeParticle.maxTime)
  419. {
  420. backPlanetreeParticle.particle[i].active = true;
  421. backPlanetreeParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  422. backPlanetreeParticle.spawnTime = 0;
  423. backPlanetreeParticle.maxTime = GetRandomValue (3, 10);
  424. }
  425. }
  426. }
  427. // Dandelion particle
  428. if (dandelionParticle.active)
  429. {
  430. dandelionParticle.spawnTime += 1*TIME_FACTOR;
  431. dandelionBackParticle.spawnTime += 1*TIME_FACTOR;
  432. for (int i = 0; i < MAX_particle; i++)
  433. {
  434. if (!dandelionParticle.particle[i].active && dandelionParticle.spawnTime >= dandelionParticle.maxTime)
  435. {
  436. dandelionParticle.particle[i].active = true;
  437. dandelionParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  438. dandelionParticle.spawnTime = 0;
  439. dandelionParticle.maxTime = GetRandomValue (5, 20);
  440. }
  441. if (!dandelionBackParticle.particle[i].active && dandelionBackParticle.spawnTime >= dandelionBackParticle.maxTime)
  442. {
  443. dandelionBackParticle.particle[i].active = true;
  444. dandelionBackParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  445. dandelionBackParticle.spawnTime = 0;
  446. dandelionBackParticle.maxTime = GetRandomValue (3, 10);
  447. }
  448. }
  449. }
  450. // Flower Particle
  451. if (flowerParticle.active)
  452. {
  453. flowerParticle.spawnTime += 1*TIME_FACTOR;
  454. backFlowerParticle.spawnTime += 1*TIME_FACTOR;
  455. for (int i = 0; i < MAX_particle; i++)
  456. {
  457. if (!flowerParticle.particle[i].active && flowerParticle.spawnTime >= flowerParticle.maxTime)
  458. {
  459. flowerParticle.particle[i].active = true;
  460. flowerParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  461. flowerParticle.spawnTime = 0;
  462. flowerParticle.maxTime = GetRandomValue (5, 20);
  463. }
  464. if (!backFlowerParticle.particle[i].active && backFlowerParticle.spawnTime >= backFlowerParticle.maxTime)
  465. {
  466. backFlowerParticle.particle[i].active = true;
  467. backFlowerParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  468. backFlowerParticle.spawnTime = 0;
  469. backFlowerParticle.maxTime = GetRandomValue (3, 10);
  470. }
  471. }
  472. }
  473. // Storm particle
  474. if (rainStormParticle.active)
  475. {
  476. rainStormParticle.spawnTime += 1*TIME_FACTOR;
  477. for (int i = 0; i < 1024; i++)
  478. {
  479. if (!rainStormParticle.particle[i].active && rainStormParticle.spawnTime >= rainStormParticle.maxTime)
  480. {
  481. for (int j = 0; j < 16; j++)
  482. {
  483. rainStormParticle.particle[i+j].active = true;
  484. rainStormParticle.particle[i+j].position = (Vector2){GetRandomValue(100, GetScreenWidth() + 1000), GetRandomValue(-10,-20)};
  485. }
  486. rainStormParticle.spawnTime = 0;
  487. rainStormParticle.maxTime = 4;
  488. }
  489. }
  490. }
  491. // Snow Storm particle
  492. if (snowStormParticle.active)
  493. {
  494. snowStormParticle.spawnTime += 1*TIME_FACTOR;
  495. for (int i = 0; i < 256; i++)
  496. {
  497. if (!snowStormParticle.particle[i].active && snowStormParticle.spawnTime >= snowStormParticle.maxTime)
  498. {
  499. snowStormParticle.particle[i].active = true;
  500. snowStormParticle.particle[i].position = (Vector2){GetRandomValue(100, GetScreenWidth() + 800), -10};
  501. snowStormParticle.spawnTime = 0;
  502. snowStormParticle.maxTime = GetRandomValue (1, 2);
  503. }
  504. }
  505. }
  506. if (rayparticle.active)
  507. {
  508. rayparticle.spawnTime += 1*TIME_FACTOR;
  509. backRayparticle.spawnTime += 1*TIME_FACTOR;
  510. for (int i = 0; i < 20; i++)
  511. {
  512. if (!rayparticle.particle[i].active && rayparticle.spawnTime >= rayparticle.maxTime)
  513. {
  514. //printf("PARTICLEEES");
  515. rayparticle.particle[i].active = true;
  516. rayparticle.particle[i].alpha = 0.0f;
  517. rayparticle.particle[i].size = (float)(GetRandomValue(10, 20)/10);
  518. rayparticle.particle[i].position = (Vector2){GetRandomValue(300, GetScreenWidth() + 200), 0};
  519. rayparticle.particle[i].rotation = -35;
  520. rayparticle.spawnTime = 0;
  521. rayparticle.particle[i].delayCounter = 0;
  522. rayparticle.maxTime = GetRandomValue (20, 50);
  523. }
  524. if (!backRayparticle.particle[i].active && backRayparticle.spawnTime >= backRayparticle.maxTime)
  525. {
  526. backRayparticle.particle[i].active = true;
  527. backRayparticle.particle[i].alpha = 0.0f;
  528. backRayparticle.particle[i].size = (float)(GetRandomValue(5, 15)/10);
  529. backRayparticle.particle[i].position = (Vector2){GetRandomValue(300, GetScreenWidth() + 200), 0};
  530. backRayparticle.particle[i].rotation = -35;
  531. backRayparticle.spawnTime = 0;
  532. backRayparticle.particle[i].delayCounter = 0;
  533. backRayparticle.maxTime = GetRandomValue (20, 50);
  534. }
  535. }
  536. }
  537. if (rainParticle.active)
  538. {
  539. rainParticle.spawnTime += 1*TIME_FACTOR;
  540. for (int i = 0; i < MAX_particle; i++)
  541. {
  542. if (!rainParticle.particle[i].active && rainParticle.spawnTime >= rainParticle.maxTime)
  543. {
  544. rainParticle.particle[i].active = true;
  545. rainParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  546. rainParticle.spawnTime = 0;
  547. rainParticle.maxTime = GetRandomValue (1, 8);
  548. }
  549. }
  550. }
  551. if (backRainParticle.active)
  552. {
  553. backRainParticle.spawnTime += 1*TIME_FACTOR;
  554. for (int i = 0; i < MAX_particle; i++)
  555. {
  556. if (!backRainParticle.particle[i].active && backRainParticle.spawnTime >= backRainParticle.maxTime)
  557. {
  558. backRainParticle.particle[i].active = true;
  559. backRainParticle.particle[i].position = (Vector2){GetRandomValue(0, GetScreenWidth() + 200), -10};
  560. backRainParticle.spawnTime = 0;
  561. backRainParticle.maxTime = GetRandomValue (3, 10);
  562. }
  563. }
  564. }
  565. // particle Logic
  566. for (int i = 0; i < MAX_particle; i++)
  567. {
  568. if (snowParticle.particle[i].active)
  569. {
  570. snowParticle.particle[i].position.y += 2*TIME_FACTOR;
  571. snowParticle.particle[i].position.x -= 2*TIME_FACTOR;
  572. snowParticle.particle[i].rotation += 0.5*TIME_FACTOR;
  573. if (snowParticle.particle[i].position.y >= GetScreenHeight()) snowParticle.particle[i].active = false;
  574. }
  575. if (backSnowParticle.particle[i].active)
  576. {
  577. backSnowParticle.particle[i].position.y += 4*TIME_FACTOR;
  578. backSnowParticle.particle[i].position.x -= 3*TIME_FACTOR;
  579. backSnowParticle.particle[i].rotation += 0.5*TIME_FACTOR;
  580. if (backSnowParticle.particle[i].position.y >= GetScreenHeight()) backSnowParticle.particle[i].active = false;
  581. }
  582. if (planetreeParticle.particle[i].active)
  583. {
  584. planetreeParticle.particle[i].position.y += 4*TIME_FACTOR;
  585. planetreeParticle.particle[i].position.x -= 2*TIME_FACTOR;
  586. planetreeParticle.particle[i].rotation += 0.5*TIME_FACTOR;
  587. if (planetreeParticle.particle[i].position.y >= GetScreenHeight()) planetreeParticle.particle[i].active = false;
  588. }
  589. if (backPlanetreeParticle.particle[i].active)
  590. {
  591. backPlanetreeParticle.particle[i].position.y += 4*TIME_FACTOR;
  592. backPlanetreeParticle.particle[i].position.x -= 3*TIME_FACTOR;
  593. backPlanetreeParticle.particle[i].rotation += 0.5*TIME_FACTOR;
  594. if (backPlanetreeParticle.particle[i].position.y >= GetScreenHeight()) backPlanetreeParticle.particle[i].active = false;
  595. }
  596. if (dandelionParticle.particle[i].active)
  597. {
  598. dandelionParticle.particle[i].position.y += 2.5*TIME_FACTOR;
  599. dandelionParticle.particle[i].position.x -= 2*TIME_FACTOR;
  600. dandelionParticle.particle[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
  601. if (dandelionParticle.particle[i].position.y >= GetScreenHeight()) dandelionParticle.particle[i].active = false;
  602. }
  603. if (dandelionBackParticle.particle[i].active)
  604. {
  605. dandelionBackParticle.particle[i].position.y += 2*TIME_FACTOR;
  606. dandelionBackParticle.particle[i].position.x -= 3*TIME_FACTOR;
  607. dandelionBackParticle.particle[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
  608. if (dandelionBackParticle.particle[i].position.y >= GetScreenHeight()) dandelionBackParticle.particle[i].active = false;
  609. }
  610. if (flowerParticle.particle[i].active)
  611. {
  612. flowerParticle.particle[i].position.y += 2.5*TIME_FACTOR;
  613. flowerParticle.particle[i].position.x -= 2*TIME_FACTOR;
  614. flowerParticle.particle[i].rotation += 0.5*TIME_FACTOR;
  615. if (flowerParticle.particle[i].position.y >= GetScreenHeight()) flowerParticle.particle[i].active = false;
  616. }
  617. if (backFlowerParticle.particle[i].active)
  618. {
  619. backFlowerParticle.particle[i].position.y += 2*TIME_FACTOR;
  620. backFlowerParticle.particle[i].position.x -= 3*TIME_FACTOR;
  621. backFlowerParticle.particle[i].rotation += 0.5*TIME_FACTOR;
  622. if (backFlowerParticle.particle[i].position.y >= GetScreenHeight()) backFlowerParticle.particle[i].active = false;
  623. }
  624. if (rainParticle.particle[i].active)
  625. {
  626. rainParticle.particle[i].position.y += 4*TIME_FACTOR;
  627. rainParticle.particle[i].position.x -= 5*TIME_FACTOR;
  628. //rainParticle.particle[i].rotation += 0.5;
  629. if (rainParticle.particle[i].position.y >= GetScreenHeight()) rainParticle.particle[i].active = false;
  630. }
  631. if (backRainParticle.particle[i].active)
  632. {
  633. backRainParticle.particle[i].position.y += 3*TIME_FACTOR;
  634. backRainParticle.particle[i].position.x -= 3*TIME_FACTOR;
  635. //rainParticle.particle[i].rotation += 0.5;
  636. if (backRainParticle.particle[i].position.y >= GetScreenHeight()) backRainParticle.particle[i].active = false;
  637. }
  638. }
  639. for (int i = 0; i < 1024; i++)
  640. {
  641. if (rainStormParticle.particle[i].active)
  642. {
  643. rainStormParticle.particle[i].position.y += 12*TIME_FACTOR;
  644. rainStormParticle.particle[i].position.x -= 15*TIME_FACTOR;
  645. //rainParticle.particle[i].rotation += 0.5;
  646. if (rainStormParticle.particle[i].position.y >= GetScreenHeight()) rainStormParticle.particle[i].active = false;
  647. if (rainStormParticle.active == false)rainStormParticle.particle[i].alpha -= 0.01;
  648. }
  649. }
  650. for (int i = 0; i < 256; i++)
  651. {
  652. if (snowStormParticle.particle[i].active)
  653. {
  654. snowStormParticle.particle[i].position.y += 12;
  655. snowStormParticle.particle[i].position.x -= 15;
  656. snowStormParticle.particle[i].rotation += 0.5;
  657. if (snowStormParticle.particle[i].position.y >= GetScreenHeight()) snowStormParticle.particle[i].active = false;
  658. }
  659. }
  660. for (int i = 0; i < 20; i++)
  661. {
  662. if (rayparticle.particle[i].active)
  663. {
  664. rayparticle.particle[i].position.x -= 0.5*TIME_FACTOR;
  665. if (rayparticle.particle[i].fading)
  666. {
  667. rayparticle.particle[i].alpha -= 0.01f;
  668. if (rayparticle.particle[i].alpha <= 0)
  669. {
  670. rayparticle.particle[i].alpha = 0;
  671. rayparticle.particle[i].delayCounter++;
  672. if (rayparticle.particle[i].delayCounter >= 30)
  673. {
  674. rayparticle.particle[i].active = false;
  675. rayparticle.particle[i].delayCounter = 0;
  676. rayparticle.particle[i].fading = false;
  677. }
  678. }
  679. }
  680. else
  681. {
  682. rayparticle.particle[i].alpha += 0.01f;
  683. if (rayparticle.particle[i].alpha >= 0.5f)
  684. {
  685. rayparticle.particle[i].alpha = 0.5f;
  686. rayparticle.particle[i].delayCounter++;
  687. if (rayparticle.particle[i].delayCounter >= 30)
  688. {
  689. rayparticle.particle[i].delayCounter = 0;
  690. rayparticle.particle[i].fading = true;
  691. }
  692. }
  693. }
  694. }
  695. if (backRayparticle.particle[i].active)
  696. {
  697. backRayparticle.particle[i].position.x -= 0.5;
  698. if (backRayparticle.particle[i].fading)
  699. {
  700. backRayparticle.particle[i].alpha -= 0.01f;
  701. if (backRayparticle.particle[i].alpha <= 0)
  702. {
  703. backRayparticle.particle[i].alpha = 0;
  704. backRayparticle.particle[i].delayCounter++;
  705. if (backRayparticle.particle[i].delayCounter >= 30)
  706. {
  707. backRayparticle.particle[i].active = false;
  708. backRayparticle.particle[i].delayCounter = 0;
  709. backRayparticle.particle[i].fading = false;
  710. }
  711. }
  712. }
  713. else
  714. {
  715. backRayparticle.particle[i].alpha += 0.01f;
  716. if (backRayparticle.particle[i].alpha >= 0.5f)
  717. {
  718. backRayparticle.particle[i].alpha = 0.5f;
  719. backRayparticle.particle[i].delayCounter++;
  720. if (backRayparticle.particle[i].delayCounter >= 30)
  721. {
  722. backRayparticle.particle[i].delayCounter = 0;
  723. backRayparticle.particle[i].fading = true;
  724. }
  725. }
  726. }
  727. }
  728. }
  729. // Press enter to change to GAMEPLAY screen
  730. #if (defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB))
  731. if (((IsGestureDetected(GESTURE_TAP) || (GetGestureDetected() == GESTURE_DOUBLETAP)) && framesCounter >= duration))
  732. {
  733. //finishScreen = 1; // OPTIONS
  734. finishScreen = 2; // GAMEPLAY
  735. }
  736. #elif (defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB))
  737. if ((IsKeyPressed(KEY_ENTER) && framesCounter >= duration))
  738. {
  739. //finishScreen = 1; // OPTIONS
  740. finishScreen = 2; // GAMEPLAY
  741. }
  742. #endif
  743. }
  744. // Title Screen Draw logic
  745. void DrawTitleScreen(void)
  746. {
  747. BeginShaderMode(colorBlend);
  748. DrawTexturePro(atlas02, gameplay_background, (Rectangle){0, 0, gameplay_background.width*2, gameplay_background.height*2}, (Vector2){0, 0}, 0, color02);
  749. // Draw parallax
  750. DrawParallaxBack();
  751. DrawParallaxMiddle();
  752. for (int i = 0; i < MAX_particle; i++)
  753. {
  754. if (backSnowParticle.particle[i].active) DrawTexturePro(atlas02, particle_icecrystal_bw,
  755. (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 },
  756. (Vector2){ particle_icecrystal_bw.width*backSnowParticle.particle[i].size/2, particle_icecrystal_bw.height*backSnowParticle.particle[i].size/2 }, backSnowParticle.particle[i].rotation,
  757. Fade((Color){144, 214, 255, 255}, backSnowParticle.particle[i].alpha));
  758. if (backPlanetreeParticle.particle[i].active) DrawTexturePro(atlas02, particle_planetreeleaf_bw,
  759. (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 },
  760. (Vector2){ particle_planetreeleaf_bw.width*backPlanetreeParticle.particle[i].size/2, particle_planetreeleaf_bw.height*backPlanetreeParticle.particle[i].size/2 }, backPlanetreeParticle.particle[i].rotation,
  761. Fade((Color){179, 86, 6, 255}, backPlanetreeParticle.particle[i].alpha));
  762. if (dandelionBackParticle.particle[i].active) DrawTexturePro(atlas02, particle_dandelion_bw,
  763. (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 },
  764. (Vector2){ particle_dandelion_bw.width*dandelionBackParticle.particle[i].size/2, particle_dandelion_bw.height*dandelionBackParticle.particle[i].size/2 }, dandelionBackParticle.particle[i].rotation,
  765. Fade((Color){202, 167, 126, 255}, dandelionBackParticle.particle[i].alpha));
  766. if (backFlowerParticle.particle[i].active) DrawTexturePro(atlas02, particle_ecualyptusflower_bw,
  767. (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 },
  768. (Vector2){ particle_ecualyptusflower_bw.width*backFlowerParticle.particle[i].size/2, particle_ecualyptusflower_bw.height*backFlowerParticle.particle[i].size/2 }, backFlowerParticle.particle[i].rotation,
  769. Fade((Color){218, 84, 108, 255}, backFlowerParticle.particle[i].alpha));
  770. if (backRainParticle.particle[i].active) DrawTexturePro(atlas02, particle_waterdrop_bw,
  771. (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 },
  772. (Vector2){ particle_waterdrop_bw.width*backRainParticle.particle[i].size/2, particle_waterdrop_bw.height*backRainParticle.particle[i].size/2 }, backRainParticle.particle[i].rotation,
  773. Fade((Color){144, 183, 187, 255}, backRainParticle.particle[i].alpha));
  774. }
  775. for (int i = 0; i < 20; i++)
  776. {
  777. if (backRayparticle.particle[i].active) DrawTexturePro(atlas02, gameplay_back_fx_lightraymid,
  778. (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 },
  779. (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,
  780. Fade(GOLD, backRayparticle.particle[i].alpha));
  781. }
  782. DrawParallaxFront();
  783. for (int i = 0; i < 5; i++)
  784. {
  785. DrawTexturePro(atlas02, gameplay_props_tree, (Rectangle){bamboo[i].x, bamboo[i].y, 43, 720}, (Vector2){0, 0}, 0, color03);
  786. //DrawRectangleRec(bamboo[i], Fade(LIME, 0.5));
  787. }
  788. EndShaderMode();
  789. DrawTextureRec(atlas01, koalaMenu, (Vector2){player.x - player.width, player.y - 40}, WHITE);
  790. BeginShaderMode(colorBlend);
  791. DrawTexturePro(atlas02, gameplay_back_ground00, (Rectangle){0, 637, gameplay_back_ground00.width*2, gameplay_back_ground00.height*2}, (Vector2){0,0}, 0, color00);
  792. EndShaderMode();
  793. 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);
  794. 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);
  795. if ((framesCounter/60)%2 && framesCounter >= duration) DrawTextEx(font, pressToPlay, (Vector2){ GetScreenWidth()/2 - fontSize.x/2, GetScreenHeight()/2 + fontSize.y*2 }, font.baseSize, 2, (Color){247, 239, 209, 255});
  796. for (int i = 0; i < MAX_particle; i++)
  797. {
  798. if (snowParticle.particle[i].active) DrawTexturePro(atlas01, particle_icecrystal,
  799. (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 },
  800. (Vector2){ particle_icecrystal.width*snowParticle.particle[i].size/2, particle_icecrystal.height*snowParticle.particle[i].size/2 }, snowParticle.particle[i].rotation,
  801. Fade(snowParticle.particle[i].color, snowParticle.particle[i].alpha));
  802. if (planetreeParticle.particle[i].active) DrawTexturePro(atlas01, particle_planetreeleaf,
  803. (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 },
  804. (Vector2){ particle_planetreeleaf.width*planetreeParticle.particle[i].size/2, particle_planetreeleaf.height*planetreeParticle.particle[i].size/2 }, planetreeParticle.particle[i].rotation,
  805. Fade(planetreeParticle.particle[i].color, planetreeParticle.particle[i].alpha));
  806. if (dandelionParticle.particle[i].active) DrawTexturePro(atlas01, particle_dandelion,
  807. (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 },
  808. (Vector2){ particle_dandelion.width*dandelionParticle.particle[i].size/2, particle_dandelion.height*dandelionParticle.particle[i].size/2 }, dandelionParticle.particle[i].rotation,
  809. Fade(dandelionParticle.particle[i].color, dandelionParticle.particle[i].alpha));
  810. if (flowerParticle.particle[i].active) DrawTexturePro(atlas01, particle_ecualyptusflower,
  811. (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 },
  812. (Vector2){ particle_ecualyptusflower.width*flowerParticle.particle[i].size/2, particle_ecualyptusflower.height*flowerParticle.particle[i].size/2 }, flowerParticle.particle[i].rotation,
  813. Fade(flowerParticle.particle[i].color, flowerParticle.particle[i].alpha));
  814. if (rainParticle.particle[i].active) DrawTexturePro(atlas01, particle_waterdrop,
  815. (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 },
  816. (Vector2){ particle_waterdrop.width*rainParticle.particle[i].size/2, particle_waterdrop.height*rainParticle.particle[i].size/2 }, rainParticle.particle[i].rotation,
  817. Fade(rainParticle.particle[i].color, rainParticle.particle[i].alpha));
  818. }
  819. for (int i = 0; i < 1024; i++)
  820. {
  821. if (rainStormParticle.particle[i].active) DrawTexturePro(atlas01, particle_waterdrop,
  822. (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 },
  823. (Vector2){ particle_waterdrop.width*rainStormParticle.particle[i].size/2, particle_waterdrop.height*rainStormParticle.particle[i].size/2 }, rainStormParticle.particle[i].rotation,
  824. Fade(rainStormParticle.particle[i].color, rainStormParticle.particle[i].alpha));
  825. }
  826. for (int i = 0; i < 256; i++)
  827. {
  828. if (snowStormParticle.particle[i].active) DrawTexturePro(atlas01, particle_icecrystal,
  829. (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 },
  830. (Vector2){ particle_icecrystal.width*snowStormParticle.particle[i].size/2, particle_icecrystal.height*snowStormParticle.particle[i].size/2 }, snowStormParticle.particle[i].rotation,
  831. Fade(snowStormParticle.particle[i].color, snowStormParticle.particle[i].alpha));
  832. }
  833. for (int i = 0; i < 20; i++)
  834. {
  835. if (rayparticle.particle[i].active) DrawTexturePro(atlas01, gameplay_fx_lightraymid,
  836. (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 },
  837. (Vector2){ gameplay_fx_lightraymid.width*rayparticle.particle[i].size/2, gameplay_fx_lightraymid.height*rayparticle.particle[i].size/2 }, rayparticle.particle[i].rotation,
  838. Fade(rayparticle.particle[i].color, rayparticle.particle[i].alpha));
  839. }
  840. /*
  841. DrawTexturePro(atlas01, title_twitter, (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.1, title_twitter.width, title_twitter.height}, (Vector2){0,0}, 0, WHITE);
  842. DrawTexturePro(atlas01, title_facebook, (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.3, title_facebook.width, title_facebook.height}, (Vector2){0,0}, 0, WHITE);
  843. DrawTexturePro(atlas01, title_googleplay, (Rectangle){ GetScreenWidth()*0.85, GetScreenHeight()*0.5, title_googleplay.width, title_googleplay.height}, (Vector2){0,0}, 0, WHITE);
  844. 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);
  845. else DrawTexturePro(atlas01, title_music_off, (Rectangle){soundButton.x, soundButton.y, title_music_off.width, title_music_off.height}, (Vector2){0,0}, 0, WHITE);
  846. 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);
  847. else DrawTexturePro(atlas01, title_speaker_off, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_off.width, title_speaker_off.height}, (Vector2){0,0}, 0, WHITE);
  848. */
  849. }
  850. // Title Screen Unload logic
  851. void UnloadTitleScreen(void)
  852. {
  853. // ...
  854. }
  855. // Title Screen should finish?
  856. int FinishTitleScreen(void)
  857. {
  858. return finishScreen;
  859. }
  860. static void DrawParallaxFront(void)
  861. {
  862. Rectangle ground01 = gameplay_back_ground01;
  863. //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);
  864. 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);
  865. 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);
  866. 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);
  867. 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);
  868. 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);
  869. 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);
  870. 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);
  871. 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);
  872. DrawTexturePro(atlas02, gameplay_back_ground01, (Rectangle){0, 559, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
  873. 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);
  874. }
  875. static void DrawParallaxMiddle(void)
  876. {
  877. Rectangle ground02 = gameplay_back_ground02;
  878. //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);
  879. 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);
  880. 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);
  881. 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);
  882. 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);
  883. 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);
  884. 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);
  885. 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);
  886. 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);
  887. DrawTexturePro(atlas02, gameplay_back_ground02, (Rectangle){0, 509, ground02.width*2, ground02.height*2}, (Vector2){0,0}, 0, color01);
  888. 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);
  889. }
  890. static void DrawParallaxBack(void)
  891. {
  892. Rectangle ground03 = gameplay_back_ground03;
  893. //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);
  894. 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);
  895. 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);
  896. 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);
  897. 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);
  898. 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);
  899. 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);
  900. 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);
  901. 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);
  902. DrawTexturePro(atlas02, gameplay_back_ground03, (Rectangle){0, 469, ground03.width*2, ground03.height*2}, (Vector2){0,0}, 0, color01);
  903. 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);
  904. }
  905. static float BounceEaseOut(float t,float b , float c, float d)
  906. {
  907. if ((t/=d) < (1/2.75f)) {
  908. return c*(7.5625f*t*t) + b;
  909. } else if (t < (2/2.75f)) {
  910. float postFix = t-=(1.5f/2.75f);
  911. return c*(7.5625f*(postFix)*t + .75f) + b;
  912. } else if (t < (2.5/2.75)) {
  913. float postFix = t-=(2.25f/2.75f);
  914. return c*(7.5625f*(postFix)*t + .9375f) + b;
  915. } else {
  916. float postFix = t-=(2.625f/2.75f);
  917. return c*(7.5625f*(postFix)*t + .984375f) + b;
  918. }
  919. }