Difference between revisions of "Today"
From CodeStuff
| Line 1: | Line 1: | ||
| − | |||
| − | |||
| − | |||
<edcode> | <edcode> | ||
| + | var player = {x:300,y:400} | ||
| + | var alien = {x:200,y:100} | ||
| + | var bullet = {x:200, y:200} | ||
| + | |||
| + | |||
| + | function move() { | ||
| + | |||
| + | } | ||
| + | |||
| + | function draw() { | ||
| + | print("player"); | ||
| + | print(player.x); | ||
| + | print(player.y); | ||
| + | |||
| + | drawPlayerShip(player.x,player.y); | ||
| + | |||
| + | drawAlienShip(alien.x,alien.y); | ||
| + | |||
| + | drawBullet(bullet.x,bullet.y) | ||
| + | } | ||
| + | |||
| + | function drawPlayerShip(x,y) { | ||
| + | drawLine(x,y-30, x+10,y+30); | ||
| + | drawLine(x,y-30, x-10,y+30); | ||
| + | } | ||
| + | function drawAlienShip(x,y) { | ||
| + | fillCircle(x,y,20); | ||
| + | } | ||
| + | function drawBullet(x,y) { | ||
| + | fillCircle(x,y,3); | ||
| + | } | ||
| + | run(move,draw); | ||
</edcode> | </edcode> | ||