I want an enemy to move in my scrolling game, but whenever I program it to, the
<when green flag clicked>
<forever>
Set x to scrollx + 480*1
<end>
script messes up the movement.
Please help!!!!!!!
Offline
Offline
fullmoon wrote:
Post a link to the project, I'll see what I can do.
It's for co-lab, but here you go:
http://scratch.mit.edu/projects/ian528/1567713
Offline
[When Green flag pressed]
[forever]
[][set x to ((scrollX) + (position))]
[/endforever]
[when green flag clicked]
[set position to (960)]
[forever]
[if <not dead> (add your statemnt)]
[][if <position < (maxBounds)>]
[][][if position > (lowerBounds)>]
[][][](add script)
[][][end if]
[][end if]
[end forever]
You can add other stuff too, if you want.
Offline
bbbeb wrote:
[When Green flag pressed]
[forever]
[][set x to ((scrollX) + (position))]
[/endforever]
[when green flag clicked]
[set position to (960)]
[forever]
[if <not dead> (add your statemnt)]
[][if <position < (maxBounds)>]
[][][if position > (lowerBounds)>]
[][][](add script)
[][][end if]
[][end if]
[end forever]
You can add other stuff too, if you want.
Ok, I will try it...............
Offline
Just in case that doesn't work I'll try and explain it
What I would do is make the enemies move as you would normally want them to move if the game didn't scroll at all, and then add in the scrolling feature.
So say your enemy runs from the left to right by going
(forever){
Change "xPos" by ( )
set x to "xPos
}
then you just need to add in the xScroll variable too.
(forever){
Change "xPos" by ( )
set x to "xPos +/- "xScroll"
}
it's +/- because depending on which way you've done the scrolling it will be different.
Hope that if the previous statement didn't help then that one does
Offline
NeoAtVic wrote:
Just in case that doesn't work I'll try and explain it
What I would do is make the enemies move as you would normally want them to move if the game didn't scroll at all, and then add in the scrolling feature.
So say your enemy runs from the left to right by going
(forever){
Change "xPos" by ( )
set x to "xPos
}
then you just need to add in the xScroll variable too.
(forever){
Change "xPos" by ( )
set x to "xPos +/- "xScroll"
}
it's +/- because depending on which way you've done the scrolling it will be different.
Hope that if the previous statement didn't help then that one does![]()
It worked! Thanks!!!
Offline