alice-teacher Using events on WASD keys and ARROW keys problem

Don Slater don at alice.org
Fri Jan 8 14:33:42 EST 2016


Interesting. It seems that the KeyPressListener and the ArrowKeyPressListener cannot be implemented at the same time. And it seems, in your example, anyway, that arrowKeyPressed overrides keyPress, but that may be an artifact of this particular implementation.

My suggestion is the you use only KeyPressListener, which gives you access to all keys on the keyboard, including the arrow keys. I have attached my solution.

Let me know if you have any questions…

All the best,
Don Slater

Alice Team
Carnegie Mellon University
Entertainment Technology Center
700 Technology Drive
Pittsburgh, PA 15219

Email: dslater at cmu.edu

I have learned this at least by my experiment: that if one advances confidently in the direction of his dreams, and endeavors to live the life he has imagined, he will meet with a success unexpected in common hours.
--- Henry David Thoreau

The true object of all human life is play. -- G.K. Chesterton


> On Jan 8, 2016, at 8:23 AM, Steven Pleau via alice-teachers <alice-teachers at lists.andrew.cmu.edu> wrote:
> 
> Sorry for the delay.
> 
> Here is the file with the events for both WASD and Arrow keys.
> 
> Only they Arrow keys work?
> 
> Thanks
> 
> Steve
> 
> Steven Pleau
> Computer Programming & Web Development Teacher
> Assabet Valley Regional Technical High School
> 215 Fitchburg Street
> Marlborough,MA 01752
> spleau at assabet.org <mailto:spleau at assabet.org>
> 
> On Wed, Jan 6, 2016 at 11:02 AM, Don Slater via alice-teachers <alice-teachers at lists.andrew.cmu.edu <mailto:alice-teachers at lists.andrew.cmu.edu>> wrote:
> Would you please send a copy of the world, or a screen shot of their implementation?
> 
> Thank you,
> 
> Don Slater
> 
> Alice Team
> Carnegie Mellon University
> Entertainment Technology Center
> 700 Technology Drive
> Pittsburgh, PA 15219
> 
> Email: dslater at cmu.edu <mailto:dslater at cmu.edu>
> 
> I have learned this at least by my experiment: that if one advances confidently in the direction of his dreams, and endeavors to live the life he has imagined, he will meet with a success unexpected in common hours.
> --- Henry David Thoreau
> 
> The true object of all human life is play. -- G.K. Chesterton
> 
> 
>> On Jan 6, 2016, at 10:54 AM, Steven Pleau via alice-teachers <alice-teachers at lists.andrew.cmu.edu <mailto:alice-teachers at lists.andrew.cmu.edu>> wrote:
>> 
>> Hi gang,
>> 
>> My students are trying to get the WASD keys and ARROW keys to work simultaneously in a world, but when they add the ARROW keys the WASD keys no longer work?
>> 
>> Any suggestions/solutions?
>> 
>> Thanks
>> 
>> Steve
>> 
>> Steven Pleau
>> Computer Programming & Web Development Teacher
>> Assabet Valley Regional Technical High School
>> 215 Fitchburg Street
>> Marlborough,MA 01752
>> spleau at assabet.org <mailto:spleau at assabet.org>
>> _______________________________________________
>> alice-teachers mailing list
>> alice-teachers at lists.andrew.cmu.edu <mailto:alice-teachers at lists.andrew.cmu.edu>
>> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers <https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers>
> 
> 
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu <mailto:alice-teachers at lists.andrew.cmu.edu>
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers <https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers>
> 
> 
> <BrandonAnway_Game1ERROR.a3p>_______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20160108/befbac56/attachment-0001.html>


More information about the alice-teachers mailing list