This site requires JavaScript, please enable it in your browser!
Greenfoot back
darkmist255
darkmist255 wrote ...

2012/5/21

Question about List

darkmist255 darkmist255

2012/5/21

#
A thought that I had was that rather than do my usual for pressing keys:
if(shotButtonReleased && Greenfoot.isKeyDown("space"))
        {
            //some action
            spaceReleased = false;
        }
        if(!Greenfoot.isKeyDown("space"))
        {
            spaceReleased = true;
        } 
I could just keep a List of keys pressed. Can "List" only contain Objects, or can it contain Strings? If it can't contain Strings, is this idea logical using an array? Also, if this idea is more trouble than just keeping a variable for each key I need to track (not many now, just more for future reference)?
danpost danpost

2012/5/21

#
The String class directly extends the Object class. So, a String is an Object!
You need to login to post a reply.