In Pokemon the character generally stays in the centre of the screen. Here's how to move an image around the screen, however:
Some recommended setup, this makes a consistent framerate of 30fps
sync on
sync rate 30
First you need to load the image, using the LOAD IMAGE command:
load image "player.bmp",1
player.bmp is the name of a bitmap you'll need to have in the same folder as your code. It loads the image into image 1, this is the number you use to reference it later.
Then, make some variables to hold the position:
x=300
y=200
The next part will have to be enclosed in a do..loop so it continues running and allows user input.
do
Some user input, we're just going to move the image (known as a sprite) left and right using the arrowkeys, by changing the variables containing the position of the sprite whenever the arrowkeys are pressed.
if leftkey()=1 then x=x-1
if rightkey()=1 then x=x+1
Then we display the sprite. The SPRITE command takes four values, the number of the sprite, the x and y coordinates and the number of the image (we loaded image 1 above, so use that). Just to show that the sprite number doesn't have to be the same as the image number, I'm going to use sprite number 5.
sprite 5,x,y,1
Update the screen and end the loop
sync
loop
The whole program therefore is:
sync on
sync rate 30
load image "player.bmp",1
x=300
y=200
do
if leftkey()=1 then x=x-1
if rightkey()=1 then x=x+1
sprite 5,x,y,1
sync
loop
To do animation, you'll need to load several images, each with one frame of animation, using different image numbers, then change the image number that the sprite uses (the last value) each frame to cycle through the animation.
Once I was but the learner,
now, I am the Master.