canvas = document.createElement("canvas");
canvas.width = 320;
canvas.height = 480;
canvas.style.background = "#F0F";
context = canvas.getContext("2d");
document.body.appendChild(canvas);
playerX = 100;
playerY = 100;
keyboard = [];
window.onkeydown = function(e) {keyboard[e.keyCode]=true};
window.onkeyup = function(e) {keyboard[e.keyCode]=false};
setInterval(function() {
if (keyboard[37]) playerX--;
if (keyboard[39]) playerX++;
if (keyboard[38]) playerY--;
if (keyboard[40]) playerY++;
context.clearRect(0, 0, canvas.width, canvas.height);
context.fillStyle = "#0F0";
context.fillRect(playerX, playerY, 20, 20);
}, 16);If kids today are not getting sucked into programming, then in my opinion the reason is more to do with all the things online competing with programming for their time.
But still, thinking back I remember disliking Delphi compared to VB because I thought it to be too complicated. “Why do I need a class just to have a window? And what's all that stuff I don't know from Pascal? Eek! Back to VB.”
In retrospect that sounds silly, but when you're a beginner with no formal education in the field the priorities are perhaps different. At least they were for me. I ended up writing Object Pascal code years later and learned a lot more languages, but I guess most of my initial fiddling and writing fun things was with QB and TP. No forced OOP, not too many concepts to learn before starting (I stayed away from PEEK and POKE because I didn't understand what they did). Javascript doesn't really feel like a beginner-friendly language to me, actually. To grasp that snippet above you have to figure out at least parts of the DOM and events. I probably wouldn't have done that back then.
______
¹ Yes, I already had hard drives in my day. The one time I sat at a computer with a cassette tape drive was when I was three and my father never let me use it again afterwards – randomly mashing buttons was not very appreciated, I guess.
Furthermore, if you learn the dirty hack known as HTML/CSS/JS first...you will forever be tainted. Javascript will become "good enough" for every programming task. It's not.
I mean, I'm 40, been in to computing since I was 8 ish. I even built my own from components on bread boards. Yesterday, I looked at the Torque Engine, I gave up. I couldn't even set it up to use. And I've got a damn degree in Computer Science!!!!!
Heh, I almost think any kid who gets in to development of any kind right now deserves some sort of award.
But, I do think that on the other hand, people should lay off this idea that "everyone" should know it all, and stop giving mere users a hard time for not knowing or wanting to know all the insane abstracts we know.
Without RPI:
You don't know anything. You go to a tutorial. You have to download some stuff. There are win32, x64, OS X, linux, etc versions. There's python 2.x, 3.x, etc versions. There is pygame etc. And editors. (All of this is sort of fixed by Learn X the hard way).
With RPI:
Hopefully it's all included in a distro.
You can go to the tutorial and just start.
What would be useful is some python version of the type-it-in and run it listings that appeared in magazines. I found these particularly useful for learning - especially bugfix afterwards. And then tinkering the software to produce different effects. Starting with something and modifying it was a much easier introduction that just creating it all from scratch.