I just coded pong (you know the game with the two paddles and the ball) in JavaScript.
Why you ask?
Because I coded it specifically so that when the user stretches the window, the playing field also stretches.
Why you ask?
Because at work there is a guy who I share a cubicle with who has THREE MONITORS. So I plan to use his workstation to stretch the browser window across all three monitors and play long pong.
>>9
This is basically the reason everyone should start their programming careers by reading SICP.
Name:
Anonymous2009-01-18 6:57
Why is there no lispscript. This would have taken 5 lines. I would have used a fbetrigjgjrijgirrg-lisp-terminology and fapped all over myself. As the semen cooled upon my stomach, i would know that that is as good as my life could ever be.
Name:
Anonymous2009-01-18 7:26
>>15
explain yourself if you are in fact not a troll
this is dreadful. Why must each player use the same keys?? how is that ergonomic? Or do you not have any friends so you didn't envisage that scenario?
What about the score? WHy is there not a bounded header area for score and whatever. The left bat just clobbers the score. This is completely retarded. Absolotely terrible. Also there's some kind of fucked up inertia on the bats and they don't move straight away.
Name:
Anonymous2009-01-18 8:08
>>29
>Why must each player use the same keys??
Yeah I basically meant it only for one player. Making it 2 players wouldn't be difficult.
>What about the score?
The score's just an afterthought. The whole thing's just a joke so the score doesn't matter. Moving the score wouldn't be difficult at all, just add style="left: 50%;" to the score div.
>Also there's some kind of fucked up inertia on the bats and they don't move straight away.
That's a defect in JavaScript. The key inputs have to come via a keyboard event, so I can't just poll the keyboard every loop. You have to tap the keyboard to move the paddles. Each tap of up or down will accelerate the paddle in that direction.
Name:
Anonymous2009-01-18 8:13
>>20
Well I'm sorry, but this is not enterprise quality. What about if it was rewritten as a java applet. Would the keys be better/
"The key inputs have to come via a keyboard event, so I can't just poll the keyboard every loop."
The event loop should be instead event driven routine which manipulates normal flow.
_________________________
orbis terrarum delenda est
for example when Event A occurs after loop finished it gets delayed to next loop cycle(the paddle updated coord.).
Event driven routine would reposition the paddle as key is pushed.The whole thing would be better looking with <canvas>.
_________________________
orbis terrarum delenda est