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

#1 2008-07-06 12:46:51

newareagle
Scratcher
Registered: 2008-06-10
Posts: 100+

How to make objects move in a scroller.

In my lastest game, super mario brothers, I wanted to put in a few moving enemies. Only one problem, its a scrollers. Is there an eqaution or script that calculates the enemies position of the game is scrolling also? Many people might not understand this. What I am getting at is when you scroll, your x position isn't changing, the background is. If you put a enemy in during stage 3 lets say, it will go through pipes, walls and other obstacles because its not moving with the scrolling, but with the x and y positions. Any help?


My Guitar Hero Game.
8/9 Projects on the Front Page at Once!

Offline

 

#2 2008-07-06 12:53:20

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: How to make objects move in a scroller.

Weel, first find when you want it to show and hide using the If/Else block. Than do this:

[blocks]<forever>[/blocks]
[blocks]<set x to( (( <{ ScrollX  }>  <+> <{ Enemy movement }>  ))[/blocks]
[blocks]<end>[/blocks]

Now, it will set it to a local variable called movement. So, when green flag clicked, set movement to either -480, -480*2, etc. But also, the sorite will be changing it's movement by like 5, so it will start moving


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#3 2008-07-06 13:02:00

newareagle
Scratcher
Registered: 2008-06-10
Posts: 100+

Re: How to make objects move in a scroller.

Hmmmm.... thats sound pretty good. I would have to change enemy movement to a number then, 5+ that number, etc to make it move though, right?

Last edited by newareagle (2008-07-06 13:02:32)


My Guitar Hero Game.
8/9 Projects on the Front Page at Once!

Offline

 

#4 2008-07-06 13:06:34

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: How to make objects move in a scroller.

newareagle wrote:

Hmmmm.... thats sound pretty good. I would have to change enemy movement to a number then, 5+ that number, etc to make it move though, right?

You would need to change enemy movement by first positive number and than a negative number so it actually changes it's X


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#5 2008-07-06 20:09:30

AlanProjects
Scratcher
Registered: 2008-06-23
Posts: 500+

Re: How to make objects move in a scroller.

Bluestribute wrote:

Weel, first find when you want it to show and hide using the If/Else block. Than do this:

[blocks]<forever>[/blocks]
[blocks]<set x to( (( <{ ScrollX  }>  <+> <{ Enemy movement }>  ))[/blocks]
[blocks]<end>[/blocks]

Now, it will set it to a local variable called movement. So, when green flag clicked, set movement to either -480, -480*2, etc. But also, the sorite will be changing it's movement by like 5, so it will start moving

BLUESTRIBUTE!!! Thtats all i needed to know when i was making my lost  traveler game!
sad

Last edited by AlanProjects (2008-07-06 20:09:44)

Offline

 

#6 2008-07-06 20:12:12

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: How to make objects move in a scroller.

AlanProjects wrote:

Bluestribute wrote:

Weel, first find when you want it to show and hide using the If/Else block. Than do this:

[blocks]<forever>[/blocks]
[blocks]<set x to( (( <{ ScrollX  }>  <+> <{ Enemy movement }>  ))[/blocks]
[blocks]<end>[/blocks]

Now, it will set it to a local variable called movement. So, when green flag clicked, set movement to either -480, -480*2, etc. But also, the sorite will be changing it's movement by like 5, so it will start moving

BLUESTRIBUTE!!! Thtats all i needed to know when i was making my lost  traveler game!
sad

And I went searchign through the forums quickly afterwards to try and find out how. Now I could do it, though natural looking multi-directional AI's in space is still a little tricky for me


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#7 2008-07-06 20:16:50

AlanProjects
Scratcher
Registered: 2008-06-23
Posts: 500+

Re: How to make objects move in a scroller.

Bluestribute wrote:

AlanProjects wrote:

Bluestribute wrote:

Weel, first find when you want it to show and hide using the If/Else block. Than do this:

[blocks]<forever>[/blocks]
[blocks]<set x to( (( <{ ScrollX  }>  <+> <{ Enemy movement }>  ))[/blocks]
[blocks]<end>[/blocks]

Now, it will set it to a local variable called movement. So, when green flag clicked, set movement to either -480, -480*2, etc. But also, the sorite will be changing it's movement by like 5, so it will start moving

BLUESTRIBUTE!!! Thtats all i needed to know when i was making my lost  traveler game!
sad

And I went searchign through the forums quickly afterwards to try and find out how. Now I could do it, though natural looking multi-directional AI's in space is still a little tricky for me

Natural-looking AI's in space?  big_smile

Offline

 

#8 2008-07-08 14:37:37

newareagle
Scratcher
Registered: 2008-06-10
Posts: 100+

Re: How to make objects move in a scroller.

AlanProjects wrote:

Bluestribute wrote:

AlanProjects wrote:


BLUESTRIBUTE!!! Thtats all i needed to know when i was making my lost  traveler game!
sad

And I went searchign through the forums quickly afterwards to try and find out how. Now I could do it, though natural looking multi-directional AI's in space is still a little tricky for me

Natural-looking AI's in space?  big_smile

Rofl quite off-topic arent we  tongue


My Guitar Hero Game.
8/9 Projects on the Front Page at Once!

Offline

 

#9 2008-07-10 06:35:55

tro95
Scratcher
Registered: 2008-02-20
Posts: 78

Re: How to make objects move in a scroller.

Try some of my scrolling tutorials!!!!!                                                                                     

[blocks]<when green flag clicked>
<forever><set x to( ((((<{ Scroll_x }>  <+> (( 480 <*> Where ever )) )  <+> <{ Enemy Pos_x }> )))[/blocks]

Last edited by tro95 (2008-07-10 06:36:43)

Offline

 

Board footer