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

#26 2013-02-10 13:08:12

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

By the way, thanks to everyone for helping me, I'm just a newbie trying to learn some scratch  big_smile

Offline

 

#27 2013-02-10 13:13:02

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

'We' are the same person, Sqervay is my 'private account' and on MaanGames I'll upload games and the engines...
That's a kind of wall-jumping
Here's a wiki article: http://wiki.scratch.mit.edu/wiki/Wall-Jumping
I work on en-/disabling wall-jumping, but it's very complicated   wink

Offline

 

#28 2013-02-10 13:17:39

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

Oh, I see. You know any resources so I could make my own platformer? I want to make it really simple, just one level, with collision and gravity, that's it.

Offline

 

#29 2013-02-10 13:34:54

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

*PS: It's the same engine in both projects  big_smile  *

Offline

 

#30 2013-02-10 15:01:50

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

when gf clicked
forever
  change [yvel] by (-0.4)
  set [xvel] to <[xvel] * 0.86>
  if (touching [floor])
    set [yvel] to <[yvel] * -0.34>
    change y by [yvel]
     if (touching [floor])
       change y by [yvel]
        if (touching [floor])
          change y by [yvel]
        end
      end
      if ([key w v] pressed)
        change [yvel] by (5)
      end
  end
  if ([key a v] pressed)
    change [xvel] by (-0.5)
  end
  if ([key d v] pressed)
    change [xvel] by (0.5)
  end 
  if (touching [floor])
    set [xvel] to <[xvel] * -0.8>
    change x by [xvel]
     if (touching [floor])
         change x by [xvel]
         if (touching [floor])
            change x by [xvel]
            if (touching [floor])
              change y by [xvel]
            end
        end
     end
  end
end
+moving
+gravity
+collision detection

Offline

 

#31 2013-02-10 15:04:54

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

Sqervay wrote:

when gf clicked
forever
  change [yvel] by (-0.4)
  set [xvel] to <[xvel] * 0.86>
  change x by xvel
  change y by yvel
  if (touching [floor])
    set [yvel] to <[yvel] * -0.34>
    change y by [yvel]
     if (touching [floor])
       change y by [yvel]
        if (touching [floor])
          change y by [yvel]
        end
      end
      if ([key w v] pressed)
        change [yvel] by (5)
      end
  end
  if ([key a v] pressed)
    change [xvel] by (-0.5)
  end
  if ([key d v] pressed)
    change [xvel] by (0.5)
  end 
  if (touching [floor])
    set [xvel] to <[xvel] * -0.8>
    change x by [xvel]
     if (touching [floor])
         change x by [xvel]
         if (touching [floor])
            change x by [xvel]
            if (touching [floor])
              change y by [xvel]
            end
        end
     end
  end
end
+moving
+gravity
+collision detection

Uff, I'm bad in making Scratchblocks...

Offline

 

#32 2013-02-10 16:14:34

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

Re: Making a platformer

Sqervay wrote:

Sqervay wrote:

when gf clicked
forever
  change [yvel v] by (-0.4)
  set [xvel v] to <(xvel) * (0.86)>
  change x by (xvel)
  change y by (yvel)
  if (touching [floor v]?)
    set [yvel v] to <(yvel) * (-0.34)>
    change y by (yvel)
     if (touching [floor v]?)
       change y by (yvel)
        if (touching [floor v]?)
          change y by (yvel)
        end
      end
      if (key [w v] pressed?)
        change [yvel v] by (5)
      end
  end
  if (key [a v] pressed?)
    change [xvel v] by (-0.5)
  end
  if (key [d v] pressed?)
    change [xvel v] by (0.5)
  end 
  if (touching [floor v]?)
    set [xvel v] to <(xvel) * (-0.8)>
    change x by (xvel)
     if (touching [floor v]?)
         change x by (xvel)
         if (touching [floor v]?)
            change x by (xvel)
            if (touching [floor v]?)
              change y by (xvel)
            end
        end
     end
  end
+moving
+gravity
+collision detection

Uff, I'm bad in making Scratchblocks...

Well you'll get good sooner or later, so don't worry.

Anyway, fixed.

Last edited by ErnieParke (2013-02-10 16:14:57)


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

Offline

 

#33 2013-02-10 16:25:05

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

Thanks for fixing  smile

Offline

 

#34 2013-02-10 18:56:23

Fyrox
New Scratcher
Registered: 2013-01-21
Posts: 17

Re: Making a platformer

Thanks a ton guys!

Offline

 

#35 2013-02-10 19:30:13

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

Re: Making a platformer

Sqervay wrote:

Thanks for fixing  smile

Your welcome!


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

Offline

 

#36 2013-02-11 04:02:53

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Making a platformer

Oh, I found 2 mistakes in my script:
1. if key w pressed AND YVEL > 0
2. At the end the  change y by xvel   is wrong  -> change X by xvel

Sry for the mistakes...

Offline

 

Board footer