Move image XST3

winscreen(640, 480, 0, 1);
var x = 10, y = 10;
var player = loadimage('player.png');
function moveplayer() {
var key = getKey();
switch(key) {
case 'RIGHT_ARROW':
x+= 1;
break;
case 'LEFT_ARROW':
x -= 1;
break;
case 'UP_ARROW':
y -=1;
break;
case 'DOWN_ARROW':
y +=1;
break
}
}

function main() {
clear();
moveplayer();
drawimage(player, x, y);
}

 

 

move

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s