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

#1 2009-02-25 17:18:15

Titan360
Scratcher
Registered: 2009-02-25
Posts: 3

Platform options!

Gravity, solid, etc.
Make it so we can set gravity and make an easier jump script.

Offline

 

#2 2009-02-25 17:43:40

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: Platform options!

Jumping already is easy:
<when green flag clicked>
<forever>
  <if><touching[ platform]
    <set{ yVelocity }to(1)
    <if><key[ up arrow ]pressed?>
      <set{ yVelocity }to(15)
    <end>
  <end>
<change y by( <{ yVelocity }>
<change{ yVelocity }by(-1)
<end>


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#3 2009-02-25 20:56:45

726961
Scratcher
Registered: 2008-11-26
Posts: 100+

Re: Platform options!

demosthenes wrote:

Jumping already is easy:
<when green flag clicked>
<forever>
  <if><touching[ platform]
    <set{ yVelocity }to(1)
    <if><key[ up arrow ]pressed?>
      <set{ yVelocity }to(15)
    <end>
  <end>
<change y by( <{ yVelocity }>
<change{ yVelocity }by(-1)
<end>

there are other ways to do this, but to the same effect.


http://scratch.mit.edu/projects/726961/604658 play it now! or else...

Offline

 

#4 2009-02-25 21:06:40

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Platform options!

726961 wrote:

demosthenes wrote:

Jumping already is easy:
<when green flag clicked>
<forever>
  <if><touching[ platform]
    <set{ yVelocity }to(1)
    <if><key[ up arrow ]pressed?>
      <set{ yVelocity }to(15)
    <end>
  <end>
<change y by( <{ yVelocity }>
<change{ yVelocity }by(-1)
<end>

there are other ways to do this, but to the same effect.

That is the best and simplest way though.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#5 2009-02-25 21:25:50

726961
Scratcher
Registered: 2008-11-26
Posts: 100+

Re: Platform options!

archmage wrote:

726961 wrote:

demosthenes wrote:

Jumping already is easy:
<when green flag clicked>
<forever>
  <if><touching[ platform]
    <set{ yVelocity }to(1)
    <if><key[ up arrow ]pressed?>
      <set{ yVelocity }to(15)
    <end>
  <end>
<change y by( <{ yVelocity }>
<change{ yVelocity }by(-1)
<end>

there are other ways to do this, but to the same effect.

That is the best and simplest way though.

I know, I am just saying that there is multiple ways to get a product close to what this achieves.


http://scratch.mit.edu/projects/726961/604658 play it now! or else...

Offline

 

#6 2009-05-10 08:20:14

bryano
Scratcher
Registered: 2009-04-26
Posts: 7

Re: Platform options!

Using this method the sprite flickers a lot because if you are not pressing the up key y is always being changed by yVelocity and yVelocity is always being changed by -1, how can we get around that?

Offline

 

#7 2009-05-10 09:39:35

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: Platform options!

bryano wrote:

Using this method the sprite flickers a lot because if you are not pressing the up key y is always being changed by yVelocity and yVelocity is always being changed by -1, how can we get around that?

by using more if statements...

Offline

 

Board footer