Computer Science Canada hit a key to remove picture |
Author: | venue92 [ Tue Mar 31, 2009 1:34 pm ] | ||
Post subject: | hit a key to remove picture | ||
Ok so i have objects (circles) falling down the screen, and i need it so that when i hit a specific key referring to a specific one of the circles, the circle disappears. i have no idea how to do this and any help will be greatly appreciated.
|
Author: | saltpro15 [ Tue Mar 31, 2009 2:43 pm ] | ||
Post subject: | RE:hit a key to remove picture | ||
lol I assume this is some form of guitar hero-esque game? Well an easy way to do this is to use Input.KeyDown, then check if a certain key is being pressed. example
should be fairly straightforward |
Author: | DemonWasp [ Tue Mar 31, 2009 3:43 pm ] |
Post subject: | RE:hit a key to remove picture |
The key is that you're not removing the picture, you're just not drawing it. Starting from what saltpro15 has, it goes like this: 1. On every iteration through the loop, read all the input from the keyboard and determine which notes are still around and which aren't. 2. cls 3. Draw all of the notes that are still around and everything else for the game. 4. View.Update() to draw everything to the actual screen. So in step 1, the note becomes inactive. In step 3, we draw without all inactive notes -> your note disappears! |