Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Free roam 2d shooter
- cubby208
-
Scratcher
99 posts
Free roam 2d shooter
Basically I want to create a game like xevious, only you can scroll left right and diagonally. However I'm come across an issue.
The npc's need to move in a verry simple pattern. They also need to be moving off screen. However since the space ship is allways in the center and everything else scrolls around…. How do I pull that off? At the moment I am still working on how I will keep track of objects locations, however I got stationary objects worked out. So is their a way I can have a npc's turn and move however when I scroll it scrolls with it so it looks real?
Formulas, examples are all good.
The npc's need to move in a verry simple pattern. They also need to be moving off screen. However since the space ship is allways in the center and everything else scrolls around…. How do I pull that off? At the moment I am still working on how I will keep track of objects locations, however I got stationary objects worked out. So is their a way I can have a npc's turn and move however when I scroll it scrolls with it so it looks real?
Formulas, examples are all good.
- CyberixSagaStudios
-
Scratcher
100+ posts
Free roam 2d shooter
I'm not that good at scrolling and am not sure if you're asking about this:
You can make a list with the coordinates of every single item that will move. Then, when the user clicks the left or right button, change the coordinates on the list, and use
You can make a list with the coordinates of every single item that will move. Then, when the user clicks the left or right button, change the coordinates on the list, and use
when green flag clicked
forever
if <<<(item (1 v) of [x v]) < [241]> and <(item (1 v) of [x v]) > [-241]>> and <<(item (1 v) of [y v]) < [181]> and <(item (1 v) of [y v]) > [-181]>>> then
show
else
hide
end
end
when [left arrow v] key pressed
replace item (1 v) of [x v] with ((item (1 v) of [y v]) - (1))
when [right arrow v] key pressed
replace item (1 v) of [x v] with ((item (1 v) of [y v]) + (1))
when green flag clicked
forever
go to x:(item (1 v) of [x v]) y:(item (1 v) of [y v])
end
- CyberixSagaStudios
-
Scratcher
100+ posts
Free roam 2d shooter
For the random movement, just make whatever code you need.
- casadesteve
-
Scratcher
2 posts
Free roam 2d shooter
What Scratch really needs for 2d shooters is the glide code but instead of going to coordinates maybe they can make it "glide 1 secs to (Sprite or color?)
- Discussion Forums
- » Help with Scripts
-
» Free roam 2d shooter