0

i have a game i have downloaded and built, have a file here, (file is too large to put on here), i am posting the whole thing because i dot know why the code wont work. that file is the original (from here). i am using the correct arduino for it as i have the redboard. i try to make the 0 pin an input, that when on high, turns off this bit of code :
// Draw hero on screen and check for collisions if (drawHero(heroPos, terrainUpper, terrainLower, distance >> 3)) { playing = false; // The hero collided with something. Too bad. }
i can switch the high and low testing in the modified file at the bottom of the page, but the code wont look at the state of the switch i have wired up to the 0 pin and my 5 volt rail. i am new to this btw, so if you give a possible solution, please explain it like you are tanking to a person who has coding experience, just not with arduino and c++.

the file modification is right here.

by the way, the if statement changes god mode on and off by only letting collision detection happen when the switch is on low.

this is the original circuit:https://cdn.sparkfun.com/assets/learn_tutorials/7/1/6/Endless_Runner_bb1.png added a board on the side that connects to the positive rail on the main board, then i have a switch that connects to the 0 pin and the positive rail on the side board.

migrated from stackoverflow.com Nov 27 '18 at 17:41

This question came from our site for professional and enthusiast programmers.

  • wire the button you added, the same way like the first button – Juraj Nov 27 '18 at 18:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.