Computer Science Canada

I cant get 2 player game on one keyboard

Author:  DanShadow [ Tue Dec 02, 2003 11:08 am ]
Post subject:  I cant get 2 player game on one keyboard

a variety of games ive tried to make, like 'Asteroids', I need 2 player for. I have tried a few things, most recently resorting to the 'getch' command, but...well ill explain what happens.
Player 1: [a=move left ]
[s=move right]
Player 2: [4=move left ]
[6=move right]
If Player 1 is pressing 'a', moving left, and Player 2 presses any button, Player 1 stops moving, and Player 2 moves. I cant get them to simutaneously move using 1 keyboard. Someone plz help me!

Author:  Mazer [ Tue Dec 02, 2003 11:25 am ]
Post subject: 

this used to be a huge problem for making games in turing. luckily we now have Input.KeyDown


var chars : array char of boolean % array of all keys

    Input.KeyDown (chars)

    if chars ('a') then
        put "you are pressing the a key"
    end if
end loop

it works something like that. i'm not sure exactly because i haven't used it in a while and don't have anything with me to check right now.

Author:  DanShadow [ Tue Dec 02, 2003 12:00 pm ]
Post subject:  yes

Nice! Thanks alot, this helps everything! I actually used to use that, but my teacher told me getch was better...stupid teacher, Wink

Author:  Mazer [ Tue Dec 02, 2003 12:46 pm ]
Post subject: 

Naughty never listen to your teacher. your old teacher that is. from now on, i am your teacher. uh... class dismissed.

Author:  McKenzie [ Tue Dec 02, 2003 2:20 pm ]
Post subject: 


Don't encourage him to be a punk. Yep, Shadow, your teacher dropped the ball on the Input.KeyDown, don't be so quick to assume he knows nothing.

Author:  Tony [ Tue Dec 02, 2003 4:19 pm ]
Post subject: 

McKenzie - it seriously depends on the teacher though... some seriously dont know anything... I dont even know how they get to teach computer science Rolling Eyes

A single mistake like that might not be enough to completely stop listening to the teacher, but clues like that add up...

Being a teacher yourself it might be hard for you to see student's perspective Confused

Author:  Mazer [ Tue Dec 02, 2003 6:05 pm ]
Post subject: 

i was only joking with him. danshadow, you should always respect your teacher. even though it may be difficult for you to do so because you don't have the greatest compsci teacher like i do ( Wink )

Author:  McKenzie [ Tue Dec 02, 2003 7:04 pm ]
Post subject: 

Don't get me wrong Tony, I've seen some of the worst of the worst (The stories I could tell.) I've taught beside guys who had no desire to teach CS nor had a clue. I know you're joking Mazer, but I also know how crushing it can be to be disrespected in a public forum.

Author:  Tony [ Tue Dec 02, 2003 7:13 pm ]
Post subject: 

McKenzie wrote:
The stories I could tell

maybe you can start a thread in general discussion about some of those stories? for our amusement Laughing

from personal experience... I found it a bit discouraging to be told that I've exided(spelling?) teacher's knowledge by the end of grade10 course (dont get me wrong... I had a really good teacher back then).

But still... schools probably just dont pay enough to hold a good CS teacher (and I go to private school Rolling Eyes)

Author:  Chimaera [ Tue Dec 02, 2003 9:48 pm ]
Post subject: 

yea, some comp sci teachers just rely on a degree in math sciences and possibly just a minor in comp related subjects which is the case for my comp engineering teacher. She's awesome though, she understands what we want and she's a good teacher too. You can't go wrong with a teacher that likes the same sort of music as you do!

Author:  DanShadow [ Thu Dec 04, 2003 4:15 pm ]
Post subject:  hmm

Ok. Problem is that I may know more than my compsci teacher, (in some areas) He never knew Turing was able to do anything with the internet, and thinks that making an RPG is amazingly hard. So...I do respect him, as he knows (some things) more than I, but overall....he has very little answers to the questions I have. That's one of many reasons I looked for a site like Very Happy