You will need variables for the enemy (I like to call them "h" and "k") that are the enemy's coordinates on the scrolling terrain. use this script.
when gf clicked forever go to x:((h) - (x-scroll)) y:(k) if <touching [edge v]?> hide else show endTo make the enemy chase the player use this script below.
when gf clicked forever if <not <touching [edge v]?>> if <([x position v] of [player v]) > (x position)> change [hvel v] by (1) else change [hvel v] by (-1) end set [hvel v] to ((hvel) * [0.9]) // can use other fractions to change speed change [h v] by (hvel)
Last edited by Wes64 (2012-07-27 19:20:01)
Offline
Wes64 wrote:
You will need variables for the enemy (I like to call them "h" and "k") that are the enemy's coordinates on the scrolling terrain. use this script.
when gf clicked forever go to x:((h) - (x-scroll)) y:(k) if <touching [edge v]?> hide else show endTo make the enemy chase the player use this script below.when gf clicked forever if <not <touching [edge v]?>> if <([x position v] of [player v]) > (x position)> change [hvel v] by (1) else change [hvel v] by (-1) end set [hvel v] to ((hvel) * [0.9]) // can use other fractions to change speed change [h v] by (hvel)
You'd need the enemy to react the opposite way to you when you move, so right arrow moves the enemy left
Offline
zammer990 wrote:
You'd need the enemy to react the opposite way to you when you move, so right arrow moves the enemy left
I dont think you understand the script. These are for the enemy, the (x-scroll) variable is the player's position. These work for both directions.
Offline