i am kinda new and have a question related to homework 6 (not using x_mobile and y_mobile)
(https://www.youtube.com/watch?v=_mBq68B ... BHBFFRVWsx)
so i get what chili did there but i did it in a complete different way (i guess):
i made this two functions:
Code: Select all
void Game::ScreenCap(int x, int y)
{
x = x + vx;
y = y + vy;
if (x + 5 >= gfx.ScreenWidth)
{
x = gfx.ScreenWidth - 6;
vx = 0;
}
if (x - 5 < 0)
{
x = 5;
vx = 0;
}
if (y + 5 >= gfx.ScreenHeight)
{
y = gfx.ScreenHeight - 6;
vy = 0;
}
if (y - 5 < 0)
{
y = 5;
vy = 0;
}
}
and:
Code: Select all
int Game::GetCoord(int x)
{
int y = x;
return y;
}
Code: Select all
const int x = GetCoord(x_mobile);
const int y = GetCoord(y_mobile);
ScreenCap(x, y);
tried it and it works fine
but now i am not sure if my version is fucked up or some shit because i use the x_mobile and y_mobile shit with GetCoord(); or am i fine doing so, and i just shouldnt use it in the function itself?
i hope you understand what i mean
and that i didnt violate the almighty chili forum rules
have a nice daaaay