Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post Posted: October 28th, 2017, 2:10 pm 
 

Joined: October 28th, 2017, 1:55 pm
Posts: 4
I just started beginner game development series.
i made one reticle big and it changes shape to a small one after releasing shape key.
i made it so that it won't crash when they reach edge of framework.
But whenever i release my shape changing key(Shift key) at the edges of framework my program crashes.
HELP PLEASE.
i have attached my files.


Attachments:
File comment: as said in the forum i remove the cached files.
Chili Framework 2016.zip [100.19 KiB]
Downloaded 4 times

_________________
Gold ain't good I need Platinum
Top 
 Profile  
Reply with quote  
 Post Posted: October 28th, 2017, 4:23 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 517
Location: Idiot from northern Europe
Your problem is your placement of this line

ShapeKeyIsPressed = (wnd.kbd.KeyIsPressed(VK_SHIFT));

Remember that the code in the update function will be read from the top down. Go over your Update function and see if you can figure out why the placement of that line causes an issue and why moving it to some other place will solve the issue ;)

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: October 28th, 2017, 4:29 pm 
 

Joined: October 28th, 2017, 1:55 pm
Posts: 4
Yumtard wrote:
Your problem is your placement of this line

ShapeKeyIsPressed = (wnd.kbd.KeyIsPressed(VK_SHIFT));

Remember that the code in the update function will be read from the top down. Go over your Update function and see if you can figure out why the placement of that line causes an issue and why moving it to some other place will solve the issue ;)


Thank you very much!!! it worked.
but why it caused the issue?

_________________
Gold ain't good I need Platinum


Top 
 Profile  
Reply with quote  
 Post Posted: October 28th, 2017, 5:02 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 517
Location: Idiot from northern Europe
1. the code that makes sure the reticle isnt outside of the screen gets executed
2. the code changing the shape of the reticle gets executed. (going from a small reticle at the edge of the screen to a big one means that it will now be outside of the screen.
3. your reticle is drawn

can you see how flipping the order of 1 and 2 would solve the issue?

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: October 28th, 2017, 5:46 pm 
 

Joined: October 28th, 2017, 1:55 pm
Posts: 4
Yumtard wrote:
1. the code that makes sure the reticle isnt outside of the screen gets executed
2. the code changing the shape of the reticle gets executed. (going from a small reticle at the edge of the screen to a big one means that it will now be outside of the screen.
3. your reticle is drawn

can you see how flipping the order of 1 and 2 would solve the issue?

thank you very much i understood

_________________
Gold ain't good I need Platinum


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 5 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:
cron