Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Perlenspiel Framework > shoot a Square with arrow up key

    Hello!

    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,

    noleM

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,132
    Thanks
    12
    Thanked 332 Times in 328 Posts
    How can I tell the little green square to shoot up?
    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).

    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •