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

#1 2013-02-09 17:24:02

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Making a scrolling platformer

I need help on making a scrolling platformer. The platforming and X scrolling works fine, but the Y scrolling I need help on. So the 1st platform always moves a little bit upwards each time the character jumps until it goes so far up that the character falls through. How can I make it so the platform does not go up with the character when the character jumps?


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#2 2013-02-09 17:34:29

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Making a scrolling platformer

Well, I'm not exactly sure seeing as I can't see your scripts, so could you show them?


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2013-02-09 17:43:17

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Making a scrolling platformer

I can't really show it to you...

if color green touching color black
set yvel to 0
change scrolly by -0.0001
if up arrow key pressed
change scrolly by -50
change yvel by 10
end of if
else
change scrolly by 10
change yvel by -1
end of if/else

That's for the character.


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#4 2013-02-09 18:08:30

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Making a scrolling platformer

Thescratch3 wrote:

I can't really show it to you...

if (color [#00f000] is touching [#000000] ?)
 set [yvel v] to (0)
 change [scrolly v] by (-0.0001)
 if ([up arrow v] key pressed?)
  change [scrolly v] by (-50)
  change [yvel v] by (10)
 end
else
 change [scrolly v] by (10)
 change [yvel v] by (-1)
end
That's for the character.

Wait; in the else part of your scripts, shouldn't you be changing (scrolly) by (yvel)?


http://i46.tinypic.com/35ismmc.png

Offline

 

#5 2013-02-09 23:00:24

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Making a scrolling platformer

ErnieParke wrote:

Thescratch3 wrote:

I can't really show it to you...

if (color [#00f000] is touching [#000000] ?)
 set [yvel v] to (0)
 change [scrolly v] by (-0.0001)
 if ([up arrow v] key pressed?)
  change [scrolly v] by (-50)
  change [yvel v] by (10)
 end
else
 change [scrolly v] by (10)
 change [yvel v] by (-1)
end
That's for the character.

Wait; in the else part of your scripts, shouldn't you be changing (scrolly) by (yvel)?

Really? Thanks, I'll try it out and let you know if it worked  smile


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#6 2013-02-10 00:18:46

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Making a scrolling platformer

It doesn't quite work, the platform goes to the very bottom (but the scrolling works).


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#7 2013-02-10 10:41:33

estile
Scratcher
Registered: 2013-01-26
Posts: 100+

Re: Making a scrolling platformer

try changing scrolly by ylev/some number, experiment to perfect


http://i45.tinypic.com/s4nvxl.png

Offline

 

#8 2013-02-10 14:50:12

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Making a scrolling platformer

estile wrote:

try changing scrolly by ylev/some number, experiment to perfect

Ok thanks! I'll try that out.


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#9 2013-02-10 15:23:45

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Making a scrolling platformer

It has the same effect as setting the scrolly variable to the yvel variable. Is there anyway to make it so that the platform will not to go to the very bottom? Are there any moderators online to help?


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#10 2013-02-10 16:09:41

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Making a scrolling platformer

Thescratch3 wrote:

It doesn't quite work, the platform goes to the very bottom (but the scrolling works).

Well at least the scrolling works. Could you show the scrolling scripts for your platform?


http://i46.tinypic.com/35ismmc.png

Offline

 

#11 2013-02-10 18:55:20

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Making a scrolling platformer

Sure:

when i receive -----
forever
go to x: scrollx + 480 * 0 y: scrolly + 480 * 0
end of forever

when i receive ----
forever
if scrollx > 480 or scrolly > 520
hide
else
show
end of if/else


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#12 2013-02-10 19:28:41

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Making a scrolling platformer

Thescratch3 wrote:

Sure:

when i receive [---- v]
forever
go to x: ((scrollx) + ((480) * (0))) y: ((scrolly) + ((480) * (0)))
when i receive [---- v]
forever
if <<(scrollx) > (480)> or <(scrolly) < (520)>>
hide
else
show
end

Turned into scratchblocks.

Last edited by ErnieParke (2013-02-10 19:29:16)


http://i46.tinypic.com/35ismmc.png

Offline

 

#13 2013-02-10 19:39:11

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Making a scrolling platformer

ErnieParke wrote:

Thescratch3 wrote:

Sure:

when i receive [---- v]
forever
go to x: ((scrollx) + ((480) * (0))) y: ((scrolly) + ((480) * (0)))
when i receive [---- v]
forever
if <<(scrollx) > (480)> or <(scrolly) < (520)>>
hide
else
show
end

Turned into scratchblocks.

Thanks. Do you know how to fix it?


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#14 2013-02-10 19:50:44

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Making a scrolling platformer

I'm just not going to do scrolling up and down.


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#15 2013-02-10 19:51:45

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Making a scrolling platformer

Thescratch3 wrote:

ErnieParke wrote:

Thescratch3 wrote:

Sure:

when i receive [---- v]
forever
go to x: ((scrollx) + ((480) * (0))) y: ((scrolly) + ((480) * (0)))
when i receive [---- v]
forever
if <<(scrollx) > (480)> or <(scrolly) < (520)>>
hide
else
show
end

Turned into scratchblocks.

Thanks. Do you know how to fix it?

Not entirely; just curious, what is the starting (scrolly) position of your character?


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer