Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: need help please
 Post Posted: June 24th, 2017, 5:47 pm 
 

Joined: June 22nd, 2017, 12:53 pm
Posts: 2
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.


Top 
 Profile  
Reply with quote  
 Post subject: Re: need help please
 Post Posted: June 24th, 2017, 5:55 pm 
 

Joined: April 13th, 2017, 8:35 pm
Posts: 27
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.

Top 
 Profile  
Reply with quote  
 Post subject: Re: need help please
 Post Posted: June 24th, 2017, 5:55 pm 
 

Joined: February 14th, 2017, 7:32 pm
Posts: 87
"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.


Top 
 Profile  
Reply with quote  
 Post subject: Re: need help please
 Post Posted: June 24th, 2017, 6:08 pm 
 

Joined: June 22nd, 2017, 12:53 pm
Posts: 2
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.


Top 
 Profile  
Reply with quote  
 Post subject: Re: need help please
 Post Posted: June 24th, 2017, 6:51 pm 
 

Joined: February 14th, 2017, 7:32 pm
Posts: 87
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


Top 
 Profile  
Reply with quote  
 Post subject: Re: need help please
 Post Posted: June 24th, 2017, 6:55 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 333
Location: Idiot from northern Europe
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.


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 6 posts ] 

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: