Why are some of the functions not working and how can I set the current position? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why are some of the functions not working and how can I set the current position?

https://code.sololearn.com/W81RrJSxbtga/?ref=app

8th Aug 2018, 1:45 PM
B.D
B.D - avatar
10 Answers
+ 3
You weren't changing the position correctly: https://code.sololearn.com/W7Reu41fuUT6 Set the top and left to wherever you want to go from 1 to 299 each.
8th Aug 2018, 2:59 PM
John Wells
John Wells - avatar
+ 3
yes. set a global pause flag and don't change anything in your frame functions while it is set. resume resets it and the move continues. To cancel a move, you could use another global that frame checks and clears the interval.
8th Aug 2018, 3:08 PM
John Wells
John Wells - avatar
+ 3
updated my code to add pause function. hit button second time to resume. should update button label, but I'll leave that for you to figure out.
8th Aug 2018, 3:36 PM
John Wells
John Wells - avatar
+ 3
N/p, good luck in coding!
12th Aug 2018, 7:51 AM
Vitaly Isaev
Vitaly Isaev - avatar
+ 2
thank you very much
8th Aug 2018, 3:56 PM
B.D
B.D - avatar
+ 2
Hello! I've modified your game code to fix bugs with flickering (when more than one direction pressed together) and to show more traditional way of moving game objects. https://code.sololearn.com/WvlkhOmlbWjk/?ref=app
12th Aug 2018, 6:57 AM
Vitaly Isaev
Vitaly Isaev - avatar
+ 2
thank you very much
12th Aug 2018, 7:13 AM
B.D
B.D - avatar
+ 2
thank you
12th Aug 2018, 7:55 AM
B.D
B.D - avatar
+ 1
is it possible to add functions to pause?
8th Aug 2018, 3:01 PM
B.D
B.D - avatar
+ 1
syntax?
8th Aug 2018, 3:26 PM
B.D
B.D - avatar