Update game: RE-PAIR
This commit is contained in:
parent
724e805282
commit
6ee7a81272
1 changed files with 364 additions and 197 deletions
|
|
@ -35,11 +35,10 @@ static int framesCounter = 0;
|
|||
static int finishScreen = 0;
|
||||
|
||||
static Texture2D texTitle = { 0 };
|
||||
|
||||
static Character demoChar = { 0 };
|
||||
static Texture2D texLogo = { 0 };
|
||||
|
||||
static int titlePositionY = 0;
|
||||
static int buttonPositionY = 0;
|
||||
static int titleCounter = 0;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Title Screen Functions Definition
|
||||
|
|
@ -52,44 +51,45 @@ void InitTitleScreen(void)
|
|||
finishScreen = 0;
|
||||
|
||||
texTitle = LoadTexture("resources/title.png");
|
||||
texLogo = LoadTexture("resources/raylib_logo.png");
|
||||
|
||||
demoChar = GenerateCharacter();
|
||||
player = GenerateCharacter();
|
||||
|
||||
titlePositionY = -600;
|
||||
buttonPositionY = 1600;
|
||||
titlePositionY = -200;
|
||||
}
|
||||
|
||||
// Title Screen Update logic
|
||||
void UpdateTitleScreen(void)
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
if (framesCounter > 60)
|
||||
|
||||
if (framesCounter > 5)
|
||||
{
|
||||
int partToChange = GetRandomValue(0, 4);
|
||||
|
||||
if (partToChange == 0)
|
||||
{
|
||||
demoChar.head = GetRandomValue(0, texHead.width/BASE_HEAD_WIDTH);
|
||||
demoChar.colHead = headColors[GetRandomValue(0, 5)];
|
||||
player.head = GetRandomValue(0, texHead.width/BASE_HEAD_WIDTH - 1);
|
||||
player.colHead = headColors[GetRandomValue(0, 5)];
|
||||
}
|
||||
else if (partToChange == 1) demoChar.eyes = GetRandomValue(0, texEyes.width/BASE_EYES_WIDTH);
|
||||
else if (partToChange == 2) demoChar.nose = GetRandomValue(0, texNose.width/BASE_NOSE_WIDTH);
|
||||
else if (partToChange == 3) demoChar.mouth = GetRandomValue(0, texMouth.width/BASE_MOUTH_WIDTH);
|
||||
else if (partToChange == 1) player.eyes = GetRandomValue(0, texEyes.width/BASE_EYES_WIDTH - 1);
|
||||
else if (partToChange == 2) player.nose = GetRandomValue(0, texNose.width/BASE_NOSE_WIDTH - 1);
|
||||
else if (partToChange == 3) player.mouth = GetRandomValue(0, texMouth.width/BASE_MOUTH_WIDTH - 1);
|
||||
else if (partToChange == 4)
|
||||
{
|
||||
demoChar.hair = GetRandomValue(0, texHair.width/BASE_HAIR_WIDTH);
|
||||
demoChar.colHair = hairColors[GetRandomValue(0, 9)];
|
||||
player.hair = GetRandomValue(0, texHair.width/BASE_HAIR_WIDTH - 1);
|
||||
player.colHair = hairColors[GetRandomValue(0, 9)];
|
||||
}
|
||||
|
||||
framesCounter = 0;
|
||||
}
|
||||
|
||||
titlePositionY++;
|
||||
titlePositionY += 3;
|
||||
if (titlePositionY > 40) titlePositionY = 40;
|
||||
|
||||
buttonPositionY--;
|
||||
if (buttonPositionY < 580) buttonPositionY = 580;
|
||||
titleCounter++;
|
||||
|
||||
if (IsKeyPressed(KEY_ENTER)) finishScreen = 1;
|
||||
}
|
||||
|
||||
// Title Screen Draw logic
|
||||
|
|
@ -98,26 +98,33 @@ void DrawTitleScreen(void)
|
|||
DrawTexture(background, 0, 0, GetColor(0xf6aa60ff));
|
||||
|
||||
// Draw face, parts keep changing ranomly
|
||||
DrawCharacter(demoChar);
|
||||
DrawCharacter(player, (Vector2){ GetScreenWidth()/2 - 125, 80 });
|
||||
|
||||
// Draw face rectangles
|
||||
DrawRectangleRec((Rectangle){ GetScreenWidth()/2 - BASE_EYES_WIDTH/2, 270, BASE_EYES_WIDTH, texEyes.height }, Fade(GREEN, 0.3f));
|
||||
DrawRectangleRec((Rectangle){ GetScreenWidth()/2 - BASE_NOSE_WIDTH/2, 355, BASE_NOSE_WIDTH, texNose.height }, Fade(SKYBLUE, 0.3f));
|
||||
DrawRectangleRec((Rectangle){ GetScreenWidth()/2 - BASE_MOUTH_WIDTH/2, 450, BASE_MOUTH_WIDTH, texMouth.height }, Fade(RED, 0.3f));
|
||||
//DrawRectangleRec((Rectangle){ GetScreenWidth()/2 - BASE_EYES_WIDTH/2, 270, BASE_EYES_WIDTH, texEyes.height }, Fade(GREEN, 0.3f));
|
||||
//DrawRectangleRec((Rectangle){ GetScreenWidth()/2 - BASE_NOSE_WIDTH/2, 355, BASE_NOSE_WIDTH, texNose.height }, Fade(SKYBLUE, 0.3f));
|
||||
//DrawRectangleRec((Rectangle){ GetScreenWidth()/2 - BASE_MOUTH_WIDTH/2, 450, BASE_MOUTH_WIDTH, texMouth.height }, Fade(RED, 0.3f));
|
||||
|
||||
DrawTexture(texTitle, GetScreenWidth()/2 - texTitle.width/2, titlePositionY, WHITE);
|
||||
|
||||
if (GuiButton((Rectangle){ GetScreenWidth()/2 - 440/2, buttonPositionY, 440, 80 }, "START DATE!", -1))
|
||||
if (titleCounter > 180)
|
||||
{
|
||||
finishScreen = 1; // GAMEPLAY
|
||||
PlaySound(fxCoin);
|
||||
if (GuiButton((Rectangle){ GetScreenWidth()/2 - 440/2, 580, 440, 80 }, "START DATE!", -1))
|
||||
{
|
||||
finishScreen = 1; // GAMEPLAY
|
||||
PlaySound(fxCoin);
|
||||
}
|
||||
}
|
||||
|
||||
DrawText("powered by", 20, GetScreenHeight() - texLogo.height - 35, 10, BLACK);
|
||||
DrawTexture(texLogo, 20, GetScreenHeight() - texLogo.height - 20, WHITE);
|
||||
}
|
||||
|
||||
// Title Screen Unload logic
|
||||
void UnloadTitleScreen(void)
|
||||
{
|
||||
UnloadTexture(texTitle);
|
||||
UnloadTexture(texLogo);
|
||||
}
|
||||
|
||||
// Title Screen should finish?
|
||||
|
|
|
|||
Loading…
Reference in a new issue