i am making a game where you can scroll the background with your mouse. i have a problem with the units you create and them moving within the variable scroll x. if anyone can help it would be much appreciated. this game is my attempt at the flash game age of war if you don't understand what i am talking about
Offline
work with something like
ScrollX = (mousex*2)
ScrollY = (mousey*2)
Offline
oh i see what you mean
Use a script like:
When green flagged clicked,
Forever:
If mouse x > 240,
Change scroll x by -4 (or some number)
If mouse x < - 240
Change scroll x by 4 (or some number)
And create a separate script for the terrain, one with the script, forever set x to scroll x, and the other(s) to set x to scroll x + 480, with other terrain sprites adding 480 each time.
Offline
How to use ScrollY?????????
Offline
gabrielgabriel wrote:
How to use ScrollY?????????
same as scroll x but with 360 instead of 480. Also please don't hijack other threads.
Offline
Oh, like a td or something with a huge screen that can't all be seen at once. Here's one way:
You make 2 variables for each unit: xmove and ymove. Also scrolX and scrollY for scrolling
Use it in the same way you would make terrain sprites in a scroller. Example:
When start clicked
Set xmove to -700
Set ymove to 0
Forever-
Set Xposition to scrollX+xmove
Set Yposition to scrollY+ymove
Movement example(arrow keys)
when start clicked
forever-
If right arrow pressed
Change xmove by -10
If left arrow pressed
change xmove by 10
If up arrow pressed
change ymove by -10
if down arrow pressed
change ymove by 10
************************************************************************************************************
Basically, along with the script you already have, this will get you a guy on the far right that you scroll to get to. Then you can move him with the arrow keys. You can change the movement into something like when you select the thing, then click change x and y by a multiple of it's speed until you get close to the selected area. Good luck!
Offline