As the title said, Scarfy is not loading. I know this is a common problem with a wide variety of common solutions, but I am kinda in stump right now.
Here is my code, and any Help I could get would be great.
#include “raylib.h”
int main()
{
//Creating window size
//const makes the variable impossible to change
const int HeightW {1000};
const int WidthW {950};
//Gravity by acceleration based on ((pixles/frame)frame)
const int Gravity {1};
//Custom Variable from raylib. Compound data type
Texture2D Scarfy = LoadTexture(“dapper-dasher-master-textures/texture/scarfy.png”);
//Custom variable that will load the a section of the loaded png
Rectangle ScarfyRec;
//Since there is 6 images in one file we draw from, the width will be divided by 6
ScarfyRec.width = Scarfy.width/6;
//The Height is the same as loaded texture
ScarfyRec.height = Scarfy.height;
//The starting point on the image to be loaded is 0,0 on the top left of the screen
ScarfyRec.x = 0;
ScarfyRec.y = 0;
//Position for the draw texture pact
Vector2 ScarfyPostion;
//Putting the center of Scarfy to be in the center of the Window
ScarfyPostion.x = WidthW/2 - ScarfyRec.width/2;
ScarfyPostion.y = HeightW - ScarfyRec.height;
//Jumping velocity
const int jump {-13};
//Rectangle Example/
//const int RectH {25};
//const int rectW {100};
//Velocity and Position Variables
int Velocity {0};
//Position of the rectangle will appear at the Rectangle’s height, 100 pixles above the bottom of tg
//int PosY {HeightW - rectW};
bool InAir;
InitWindow(WidthW,HeightW,“Run,run, run as fast as you can”);
SetTargetFPS(60);
//Dont forget that '!' can negate a boolean
while(!WindowShouldClose())
{
//start drawing
BeginDrawing();
//creates the background color
ClearBackground(BLACK);
//have to make sure that the starting position of the rectangle is on the bottom of the window
//ground height, if the rectangle is sitting on the bottoom of the window
if (Scarfy.height >= HeightW - ScarfyRec.width)
{
Velocity = 0;
InAir = false;
}else
{
//Rectangle is in the air
//apply gravity per each frame of the while loop
Velocity += Gravity;
InAir = true;
}
//Checking for jumping
if(IsKeyPressed(KEY_SPACE)&& !InAir)
{
Velocity +=jump;
}
//updating the position each instance of the while loop
Scarfy.height += Velocity;
DrawTextureRec(Scarfy,ScarfyRec,ScarfyPostion,WHITE);
//Creating the rectangle
//DrawRectangle(WidthW/2, PosY, RectH,rectW,WHITE);
//ends the drawing
EndDrawing();
}
UnloadTexture(Scarfy);
CloseWindow();
}
Edit: sometimes, I make unique variable names as a way to take notes so that’s why they might be different then the instructors.