need help please

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
EX_JEDEYE
Posts: 5
Joined: June 22nd, 2017, 12:53 pm
Location: Perth Western Australia

need help please

Post by EX_JEDEYE » June 24th, 2017, 5:47 pm

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.

ceofil
Posts: 39
Joined: April 13th, 2017, 8:35 pm

Re: need help please

Post by ceofil » June 24th, 2017, 5:55 pm

Hi!
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.

User avatar
Zedtho
Posts: 189
Joined: February 14th, 2017, 7:32 pm

Re: need help please

Post by Zedtho » June 24th, 2017, 5:55 pm

"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.

EX_JEDEYE
Posts: 5
Joined: June 22nd, 2017, 12:53 pm
Location: Perth Western Australia

Re: need help please

Post by EX_JEDEYE » June 24th, 2017, 6:08 pm

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.

User avatar
Zedtho
Posts: 189
Joined: February 14th, 2017, 7:32 pm

Re: need help please

Post by Zedtho » June 24th, 2017, 6:51 pm

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 :D

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: need help please

Post by Yumtard » June 24th, 2017, 6:55 pm

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.

Post Reply