need help please
need help please
hey just started coding and i'm following Chilis tutorial on youtube just need a little help i'm wondering why my crosshair isn't moving dynamically when i set int x and y into the game.h file when i build the crosshair moves into different directions but it just sits there any suggestions? cheers.
Re: need help please
Hi!
Can you paste your code in here or post a screenshot?
Can you paste your code in here or post a screenshot?
Last edited by ceofil on June 24th, 2017, 5:56 pm, edited 1 time in total.
Re: need help please
"when i build the crosshair moves into different directions but it just sits there any suggestions?"
So, when you build, your crosshair moves into a different direction and it just sits there?
If you want us to help, sending the code in an attachment would be very much appreciated for further analysis! At the moment it is slightly hard to find out what the bug is.
So, when you build, your crosshair moves into a different direction and it just sits there?
If you want us to help, sending the code in an attachment would be very much appreciated for further analysis! At the moment it is slightly hard to find out what the bug is.
Re: need help please
oh sorry guys didn't know i could do that but it's ok now i just had to change my wnd.kbd.KeyIsPressed() x and y it looked like this
if (wnd.kbd.KeyIsPressed(VK_UP))
{
y = 100;
}
but changed it around
if (wnd.kbd.KeyIsPressed(VK_UP))
{
y = y + 5;
}
something like that. its ok now though cheers for the support.
if (wnd.kbd.KeyIsPressed(VK_UP))
{
y = 100;
}
but changed it around
if (wnd.kbd.KeyIsPressed(VK_UP))
{
y = y + 5;
}
something like that. its ok now though cheers for the support.
Re: need help please
Yep, that looks like the right answer.
Good luck on your journey! Feel free to ask stuff! It might look like a lot of work to find such a bug yourself, but for people that already have encountered that bug it's pretty easy
Good luck on your journey! Feel free to ask stuff! It might look like a lot of work to find such a bug yourself, but for people that already have encountered that bug it's pretty easy
Re: need help please
EX_JEDEYE wrote:oh sorry guys didn't know i could do that but it's ok now i just had to change my wnd.kbd.KeyIsPressed() x and y it looked like this
if (wnd.kbd.KeyIsPressed(VK_UP))
{
y = 100;
}
but changed it around
if (wnd.kbd.KeyIsPressed(VK_UP))
{
y = y + 5;
}
something like that. its ok now though cheers for the support.
Yep that looks correct.
In your first example you're simply setting the y position to 100. So in the next frame the y position will be 100. In the second example you're adding 5 to the value of y. So whenever you're pressing the key, 5 will be added each frame to the value of y
say y = 100
y = y + 5;
now y = 105
//next frame
y = y + 5;
now y = 110 and so on.