splicecube's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Restricted Editor
Active Posts:
57 (0.04 per day)
Joined:
03-November 12
Profile Views:
1,012
Last Active:
User is offline Nov 01 2015 06:55 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   splicecube has not set their status

Posts I've Made

  1. In Topic: multiple key inputs not working

    Posted 16 Sep 2014

    You're not really handling multiple key presses. I'm fairly new too, this is how I came over this hurdle. I handled it by splitting it into the keyPressed() and keyReleased methods and using booleans

    In keyPressed activate boolean based on if they are pressed
    			if (e.getKeyCode() == KeyEvent.VK_UP) up = true;
    			if (e.getKeyCode() == KeyEvent.VK_DOWN) down = true;
    			if (e.getKeyCode() == KeyEvent.VK_LEFT) left = true;
    			if (e.getKeyCode() == KeyEvent.VK_RIGHT) right = true;
    
    


    In keyReleased set false the booleans for the keys that are released
    			if (e.getKeyCode() == KeyEvent.VK_UP) up = false;
    			if (e.getKeyCode() == KeyEvent.VK_DOWN) down = false;
    			if (e.getKeyCode() == KeyEvent.VK_LEFT) left = false;
    			if (e.getKeyCode() == KeyEvent.VK_RIGHT) right = false;
    
    
    


    Then in your main game loop do something like whoYouWantToMove.processKeys(up, down, left, right); where processKeys would be a method that takes in all the booleans and handles them with a series of if statements for if up,down,left,right is true so if two of them are true aka pressed both if statements would happen, moving your thing in both ways.

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

splicecube hasn't added any friends yet.

Comments

splicecube has no profile comments yet. Why not say hello?