Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Having Sprites Across a Large Map
- calebtristan5000
- Scratcher
100+ posts
Having Sprites Across a Large Map
I'm making a zombie apocalypse game, and I need help with some scripts. I have made a Scroll X / Y world, and I cannot figure out how to make zombies/coins move in relationship with the Scroll X / Y. I want the zombies to move independently, and I want the coins to spawn where the dead zombie was and stay there. Any help would be really appreciated.
Here is the link to my game:
https://scratch.mit.edu/projects/237766687/
Thank you for any help!
Here is the link to my game:
https://scratch.mit.edu/projects/237766687/
Thank you for any help!
- ShinigamiBlacky
- Scratcher
100+ posts
Having Sprites Across a Large Map
insted of changing the X and Y of the Zombie when moving change the variable ZombieX and ZombieY
forever
go to x: ((ZombieX) + (ScrollX)) y: ((ZombieY)+(ScrollY))
end
- deck26
- Scratcher
1000+ posts
Having Sprites Across a Large Map
In scrollers everything that is independent of the main character moves in terms of its real world coordinates. ScrollX/Y are used to record the user's view of the real world and are used to adjust the coordinates. Fixed objects have fixed real world coordinates and by adjusting those by scrollX/Y you get their position in terms of the viewing window which tells you whether or not they're visible. This is why scroller backdrops have an x position that is a fixed multiple of 480 plus or minus scrollx (depending how scrollx is coded to change).
Non-fixed objects like enemies or projectiles move in terms of their real world coordinates. Work out what their new position is in those terms and then apply scrollX/Y as adjustments to see where they are in viewing terms.
https://scratch.mit.edu/projects/92682141/ may help.
Non-fixed objects like enemies or projectiles move in terms of their real world coordinates. Work out what their new position is in those terms and then apply scrollX/Y as adjustments to see where they are in viewing terms.
https://scratch.mit.edu/projects/92682141/ may help.
- deck26
- Scratcher
1000+ posts
Having Sprites Across a Large Map
Edit : ninja'd by @ShinigamiBlacky but we're essentially saying the same thing. In scrollers everything that is independent of the main character moves in terms of its real world coordinates. ScrollX/Y are used to record the user's view of the real world and are used to adjust the coordinates. Fixed objects have fixed real world coordinates and by adjusting those by scrollX/Y you get their position in terms of the viewing window which tells you whether or not they're visible. This is why scroller backdrops have an x position that is a fixed multiple of 480 plus or minus scrollx (depending how scrollx is coded to change).
Non-fixed objects like enemies or projectiles move in terms of their real world coordinates. Work out what their new position is in those terms and then apply scrollX/Y as adjustments to see where they are in viewing terms.
https://scratch.mit.edu/projects/92682141/ may help.
Oops - supposed to be an edit, not a quote!
Last edited by deck26 (Aug. 10, 2018 14:06:37)
- calebtristan5000
- Scratcher
100+ posts
Having Sprites Across a Large Map
Thank you for your help, @ShinigamiBlacky and @deck26. So I can create a Zombie variable, but Can I get clones to move, or will I have to create more zombie sprites?
- ShinigamiBlacky
- Scratcher
100+ posts
Having Sprites Across a Large Map
make the variables this Sprite only to make it work with clones
Last edited by ShinigamiBlacky (Aug. 10, 2018 14:15:55)
- Discussion Forums
- » Help with Scripts
- » Having Sprites Across a Large Map