Quote: "wh dont it move monster sprite"
There is nothing in your code to move the monster sprite. You are moving the player with the arrow keys and with the move sprite command. Is it possible you meant to use MOVE SPRITE 2,2 instead of MOVE SPRITE 1,2 ?
[edit] also put the sprite command for the monster sprite before the main loop or it will keep putting it back at the same position.
sync on : sync rate 30
`Load Player Image as Image #1
load image "AlgaeBricks.bmp",1
`Load Enemies as Image #10
load image "grass2.bmp",2
`Position the player
playerX = 80
playerY = 300
`Position the enemy
monsterX = 250
monsterY = 300
`===================================================
`-----------------------------------------------------
`-----------------M_A_I_N--L_O_O_P--------------------
`-----------------------------------------------------
sprite 2,monsterX,monsterY,2
do
`The following lines below implement the Controls stated on the
sprite 1,playerX,playerY,1
`Moves the Player to the left
if leftkey() = 1 then playerX = playerX - 3
`Moves the Player to the Right
if rightkey() = 1 then playerX = playerX + 3
`Moves the Player to the up
if upkey() = 1 then playery = playery - 3
`Moves the Player to the Right
if downkey() = 1 then playery = playery + 3
MOVE SPRITE 2,1
sync
loop
The pathfinding and random code will depend on how you decide to do your levels and collision. There are many ways to do this and they all depend on other things that you use in your code.
A basic moving back and forth code would be something like this.
sync on : sync rate 30
`Load Player Image as Image #1
load image "AlgaeBricks.bmp",1
`Load Enemies as Image #10
load image "grass2.bmp",2
`load sprite
sprite 1,0,0,1
sprite 2,0,0,2
`Position the player
playerX = 80
playerY = (screen height()/2)-(sprite height(1)/2)
`Position the enemy
monsterX = 250
monsterY = (screen height()/2)-(sprite height(2)/2)
monster_speed = 2
`===================================================
`-----------------------------------------------------
`-----------------M_A_I_N--L_O_O_P--------------------
`-----------------------------------------------------
do
`The following lines below implement the Controls stated on the
sprite 1,playerX,playerY,1
sprite 2,monsterX,monsterY,2
`Moves the Player to the left
if leftkey() = 1 then playerX = playerX - 3
`Moves the Player to the Right
if rightkey() = 1 then playerX = playerX + 3
`Moves the Player to the up
if upkey() = 1 then playery = playery - 3
`Moves the Player to the Right
if downkey() = 1 then playery = playery + 3
`move the monster back and forth on the screen
monsterX = monsterX + monster_speed
`if the sprite is at the right edge of the screen or
`at the left edge then change direction
if monsterX > screen width() - sprite width(2) or monsterX <= 0
monster_speed = 0 - monster_speed
endif
sync
loop