i was making a y and x scrolling game but i can't fiish because i don't know how make sprites follow other sprite
i was scrolling with this
when flag clicked forever go to x: ((scrollX) + ((480) * (0))) y: ((scrolly) + ((360) * (0))) end
Last edited by thion (2012-06-27 02:51:00)
Offline
Oh, I see what you mean.
You want a sprite that follows the first sprite.
That is some pretty hard stuff to do...
I am not quite sure of it myself but I am sure you will need to have some of the same scripts on the following sprite.
Just set that sprite to do everything the first sprite does, just exclude the player's control over it and add a delay so it does not always overlap the player sprite.
Hope this helped a little!
Offline
I was stuck on this at first, but after a while I found out what to do:
Click on the Sprite that you want to follow the other sprite. Then add this script:
[scratchblocks]
when gf clicked
forever
go to sprite ...
[scratchblocks]
Sorry if the scratch block doesnt work It's my first time at doing them
Hope this helps
Offline
That was a fail lol!! If you don't understand the meant to be scratch block, its when green flag clicked, forever, go to sprite (number) and that should work.
Offline
Frankie101 wrote:
I was stuck on this at first, but after a while I found out what to do:
Click on the Sprite that you want to follow the other sprite. Then add this script:when gf clicked forever go to [sprite ... v]Sorry if the scratch block doesnt work It's my first time at doing them
Fixed.
use /scratchblocks at the end to close
Hope this helps
Last edited by Prestige (2012-06-28 15:35:40)
Offline
Ahh thanks! Although the go to sprite bbit is meant to be dark blue, but not sure if that matters or not
Offline
To do this, you use a normal follow script "point towards, move x steps" and then you make the sprite react the opposite way you do to movement keys, for example if you press up, you may go up but it goes down, this gives the effect of moving away, and if you do the opposite, you go towards it
Offline
Frankie101 wrote:
Ahh thanks! Although the go to sprite bbit is meant to be dark blue, but not sure if that matters or not
Its because its a drop down, go to (drop down list). To do that you add a drop down arrow, 'v', so it becomes:
go to [sprite 1 v]
go to [sprite 1 v]
Last edited by Prestige (2012-06-28 15:36:10)
Offline
Offline
when gf clicked forever set [Delta_x v] to ((Your_X) - (x)) set [Delta_y v] to ((Your_Y) - (y)) if <(Delta_y) = [0]> if <(Delta_x) < [0]> set [direction v] to [-90] else set [direction v] to [90] end else if <(Delta_y) < [0]> set [direction v] to ((180) + ( [atan v] of ((Delta_x) / (Delta_y)))) else set [direction v] to ( [atan v] of ((Delta_x) / (Delta_y))) end end change [x v] by (( [sin v] of (dir)) * (4)) change [y v] by (( [cos v] of (dir)) * (4)) endThis is for the enemy sprite. The Your_X and Your_Y are your character's x and y.
Last edited by sccar3 (2012-11-14 18:46:01)
Offline