Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
05-31-2013, 05:45 PM #1
- Join Date
- May 2013
- Thanked 0 Times in 0 Posts
Perlenspiel Framework > shoot a Square with arrow up key
I've got a little problem with my code. I'm working on a little game with the perlenspiel framework (www.perlenspiel.org). I'm a real beginner and not the best coder .___." What I'm trying to do is the following:
I want to make a little puzzle game with coloured squares (red, green and blue). When you click at one square in the last line, one colour will appear (random, but I didn't coded it until now..). I want to write some code to let the square shoot another squares (minimum 2) with the same colour. When I tap the arrow up key, the square should go up.
And if it touches another colour (for example red touches blue), it shouldn't destroy it, it should be only added. If the squares touch the bottom black line, the game is over. You win if you can destroy all the squares above the black line. Maybe you know games like this.
My problem now: I'm not able to find the mistake in my code for the keys. How can I tell the little green square to shoot up? I hope you understand my crappy english. I don't know what to do anymore with this game, it's for a school project and my teacher is ill, so he can't help me to finish this game. It would be awesome if you could give me some tips and help about the arrow key thing. What did I do wrong? .____.
I uploaded the files here.
Have a nice day wherever you are,
06-01-2013, 09:04 AM #2
- Join Date
- Jan 2010
- Behind the Wall
- Thanked 332 Times in 328 Posts
since there doesn’t seem to be any method for moving, you most probably have to move the bead yourself. i.e. depending on the key (up/left/right) pressed, move the bead a position up/left/right (delete bead in old place, create bead in new place).How can I tell the little green square to shoot up?
also look at the Perlenspiel examples, there are lot that contain user-triggered movements.
The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.André Behrens, NY Times Software Developer