I am making a game with x and y scrolling and you playing it as you where looking at it from above (For example Pokemon games and classic zelda games)
Everything works perfectly! The problem is the enemy's won't go in the place I want them to be. if that makes sense.
The game works so the main character stays still but the background scrolls.
Please help!
Offline
Offline
Um...
The background have this:
when gf clicked forever go to x: xscroll+480*0 Y: yscroll+360*0The player has
when gf clicked forever if <key right pressed> change scrollx by -5key left change xscroll by 5
Offline
please help??
Offline
How big is "the area"?
The enemies would probably need this;
when gf clicked forever set x to ((scroll x) - (x)) //the "x" variable being a "for this sprite only" variable set x to ((scroll y) - (y)) //and the "y" variableThe "x" and "y" variables would be the position of the enemies. You could make them move within a certain area by adding something like this;
if <(x) < [10]> set [x v] to [10] //changing the 10 to the minimum x, if that makes sense... set [x velocity v] to ([0] - (x velocity)) //So it turns around end if <(x) > [80]> set [x v] to [80] set [x velocity v] to ([0] - (x velocity)) endDo the same for the y. Then it should work, I'm sure you can make them move...
change [x v] by (x velocity)So x velocity is just x speed. I would try to explain better but I've go to go somewhere...
Offline
Your enemies have to scroll along with the background in order for them to stay within their designated area. If your background is scrolling to the right, the enemies have to also scroll to the right, etc..
The easiest way to do that is to add a script to the enemies that's similar to the script that you have in the background. For example, if you want an enemy to appear 50 pixels off from the center in the x direction:
when gf clicked forever set x to ((((50)+(scrollx))+(480))*(0)) set y to (((yscroll)+(360))*(0)) end
Offline