I have an idea, but I don't know whether it will work:
first I have vertical strips of cut out background (stars) that will move left or right when arrow keys pressed, with the main sprite pointing in a certain direction when the arrow keys are pressed, and the strips will move to the opposite direction, and when the strips hit the border, it reappears in the side it originally came from, so to create a scrolling background. It should create an optical illusion that the sprite is moving, but the it is always in the centre. And it is supposed to give the sprite infinite range. It works fine with some other projects I have seen, but the problem is this:
How on earth am I suppose to make sprites that is supposed to appear when the sprite goes a certain "distance" ? For example, if the sprite moves right for ten seconds, it is supposed to reach coordinate of sprite B (which appears). but if I move left, the distance to sprite B is all messed up.Considering the main sprite has NOT MOVED ANY REAL DISTANCE AT ALL, there is no way to make sure of the relative distances between sprites. I considered using a ghost minimap to keep track, but I can't figure out how to do it, and I need help.
If it happens that any of you guys find a less redundant way to achieve this, feel free to tell me.
Thanks.
Offline
Maybe a variable like this:
[blocks]<when green flag clicked>[/blocks]
[blocks]<forever if><key[ Right arrow ]pressed?>[/blocks]
[blocks]<repeat until><< <not><key[ right arrow ]pressed?> >>[/blocks]
[blocks]<wait( 1 )secsc>[/blocks]
[blocks]<change{ Time }by(1[/blocks]
[blocks]<end>[/blocks]
[blocks]<stop script>[/blocks]
And opposite for other side (left side). I really don't konw if it will work, bubt it most likely will. And when Time gets to a certain number, whatever you want happens.
P.S. Going left should change time by negative
Last edited by CFCRubiks (2008-05-27 23:59:39)
Offline
Imagine your play area as one very wide screen made up of all your sprites. You need to use a variable to keep track of your "x" co-ordinate on that "super-screen". You can position monsters, objects etc on the "super screen" by giving them an "x" location of their own, and then you can then use the "x" variable to check whether or not other things are on the actual screen or not.
My Ninja Dynamic Scroller uses this method, but it has other aspects that make it too complicated to be a good example to learn from, I'm afraid.
Offline
how do you make a minimap? what i am trying to do is be able to keep track of the moving person in a scrolling background position relative to other sprite. like a minimap in a lot of video games that shows you where you are in relation to other things.
Offline
Just make a variable that changes by .1 or something when you have the right arrow key down and subtracts .1 when the left is down. like this:
<if><key[ right ]pressed?>
<forever if><key[ right ]pressed?>
<change{ xPosition }by( .1)
<end>
<end>
And then When XPosition equals whatever have a monster Pop up.
Offline
i guess the enemy could also receave a scrolling value. More info in my Tanks game
Offline