I have no idea what happened. I came back to my project today after doing the lesson on arrays, and now when I run it both the scarfy and the nebula are moving WAY too fast when cycling frames. I went over my code, comparing it to the gitlab code, and it all looks correct. all my scarfy variables match:
//scarfy variables
Texture2D scarfy = LoadTexture("textures/scarfy.png");
AnimData scarfyData;
scarfyData.rec.width = scarfy.width/6;
scarfyData.rec.height = scarfy.height;
scarfyData.rec.x = 0;
scarfyData.rec.y = 0;
scarfyData.pos.x = windowDimensions[0]/2 - scarfyData.rec.width/2;
scarfyData.pos.y = windowDimensions[1] - scarfyData.rec.height;
scarfyData.frame = 0;
scarfyData.updateTime = 1.0/12.0;
scarfyData.runningTime = 0.0;
and my IsInAir check looks correct as well:
if(!isInAir){
//update animation frame scarfy
scarfyData.runningTime += dT;
if(scarfyData.runningTime >= scarfyData.updateTime)
{
scarfyData.updateTime = 0.0;
scarfyData.frame++;
scarfyData.rec.x = scarfyData.frame * scarfyData.rec.width;
if(scarfyData.frame>5)
{
scarfyData.frame = 0;
}
}
}
what am I missing here?
EDIT: I found the bug. In the scarfy frame animation update, I was setting updateTime to 0.0 instead of runningTime. looks like I made the same mistake for the nebulas as well! Leaving it up here in case anyone else has the same issue.