This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-01-30 17:06:18

ian528
Scratcher
Registered: 2010-05-25
Posts: 500+

Enemies moving in scrolling!

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

 

#2 2011-01-31 11:21:03

ian528
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Enemies moving in scrolling!

Bump!

Offline

 

#3 2011-01-31 15:44:13

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Enemies moving in scrolling!

Post a link to the project, I'll see what I can do.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#4 2011-01-31 15:56:24

ian528
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Enemies moving in scrolling!

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

 

#5 2011-01-31 16:07:56

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Enemies moving in scrolling!

[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.


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#6 2011-01-31 16:21:13

ian528
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Enemies moving in scrolling!

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

 

#7 2011-01-31 16:58:46

NeoAtVic
Scratcher
Registered: 2010-10-04
Posts: 67

Re: Enemies moving in scrolling!

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  smile


http://farm3.static.flickr.com/2796/4519763712_5fab3a6935_o.png

Offline

 

#8 2011-01-31 19:17:52

ian528
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Enemies moving in scrolling!

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  smile

It worked! Thanks!!!  smile

Offline

 

#9 2011-01-31 23:46:11

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Enemies moving in scrolling!

ian528 wrote:

It worked!

Glad you got it working!


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

Board footer