NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Project Help and Ideas » Moving object - possibility to make games, menus etc with
August 05, 2012 by TheFed |
So here I was wondering how to make a moving object on the lcd screen without having to code every possible position of the object. It turned out to be rather easy. To show how it works and if it works i made a '-' move right across the screen whenever i pressed the button and then when it reached the end of the screen to go back to the begining. This is only what i did with it to see if it worked. You could easily make something that could jump, move left, right etc. My circuit is really basic, the only thing you need to attach is the button switch. I attached it to the PB5 pin. And heres the code (i just edited the initialload):
I plan to make a game with this principle and maybe some joysticks if i get around to it. Note: The important parts of the code (the ones that make the object move) are the ones that concern the position variable, the button variable and that pretty much it. I hope you can use the idea and that it isnt already common knowledge that i happen to not know about yet. |
---|---|
August 05, 2012 by TheFed |
Note: I also display the position on the screen and if the button is pressed or not. This is shown on line 2 of the lcd and line 3.
|
Please log in to post a reply.
Did you know that multiple microcontrollers can communicate with each other? Learn more...
|