EDIT: For everyone in Moving Hazard lesson who has this error - the solution is in the comment section of the next lesson (thanks guys).
Rectangle nebulaRec{0.0, 0.0, nebula.width/8.f, nebula.height/8.f};
or
Rectangle nebulaRec{0.0, 0.0, (float)nebula.width/8, (float)nebula.height/8};
Hi,
when I define attributes of nebulaRec, precisely nebula.width / .height in short form:
Rectangle nebulaRec{0.0, 0.0, nebula.width/8, nebula.height/8}
I get this warning:
narrowing conversion of ‘(nebula.Texture::height / 8)’ from ‘int’ to ‘float’ [-Wnarrowing]
Everything works fine as it should but I am curious why it has happened.
Also, I’ve written different code to solve the challenge. It’s correct for now, we’ll see in the future if the cascade system will be necessary.
if((runningTime >= updateTime)
&& (!isInAir)) {
runningTime = 0.0;
//animation of scarfy - 6 images changing frame by frame
scarfyRec.x = frame * scarfyRec.width;
frame++;
if(frame > 5) {
frame=0;
}
}