need help!! Beginner mistake. but can't find it.

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
kHimanshu
Posts: 4
Joined: October 28th, 2017, 1:55 pm

need help!! Beginner mistake. but can't find it.

Post by kHimanshu » October 28th, 2017, 2:10 pm

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
Chili Framework 2016.zip
as said in the forum i remove the cached files.
(100.19 KiB) Downloaded 118 times
Gold ain't good I need Platinum

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

Re: need help!! Beginner mistake. but can't find it.

Post by Yumtard » October 28th, 2017, 4:23 pm

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 ;)

kHimanshu
Posts: 4
Joined: October 28th, 2017, 1:55 pm

Re: need help!! Beginner mistake. but can't find it.

Post by kHimanshu » October 28th, 2017, 4:29 pm

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

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

Re: need help!! Beginner mistake. but can't find it.

Post by Yumtard » October 28th, 2017, 5:02 pm

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?

kHimanshu
Posts: 4
Joined: October 28th, 2017, 1:55 pm

Re: need help!! Beginner mistake. but can't find it.

Post by kHimanshu » October 28th, 2017, 5:46 pm

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

Post Reply