Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. General Discussion
  3. How to make a simple platformer game :>

How to make a simple platformer game :>

Scheduled Pinned Locked Moved General Discussion
2d-gameshowtohowtomakehelping
4 Posts 3 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NotJaldolfYTN Offline
    NotJaldolfYTN Offline
    NotJaldolfYT
    trusted helpers
    wrote on last edited by
    #1

    To copy all code easily, go to this project 😜 play.creaticode.com/projects/679240dfee3a4781a5afde57

    Today we are making a simple platformer game! Start by making the character sprite, you can make it a square, triangle, human, squirrel, alien, anything. Set your characters size to anything, for this, I’m going with 85. Use this code to make it!

    when green flag clicked
        set size to (100) %
    

    Nice!

    Now, lets add a simple gravity system. We’re going to have to add the “LevelGround” sprite, lets do it!

    After creating that sprite, you can use this code inside of “LevelGround” to make it go to the middle, make sure your character’s sprite is at the bottom of the boundary box for creating sprites, its fine for it to be outwards 😄

    when green flag clicked
        go to center
    

    Now, for the player, copy this script for basic gravity!

    when green flag clicked
        set [Gravity v] to [0]
        forever
            change [Gravity v] by (-0.2)
            if <key [space v] pressed?> then
                set [Gravity v] to [6]
                wait until <<not <key [space v] pressed?>> and <touching (LevelGround v)?>>
            endif
        end
    end
    

    Oh, no! Our players gravity is going down super fast! Let’s fix that!

    First, add a variable called: “Cooldown”, make this simple line:

    when green flag clicked
        set [Cooldown v] to [N]
    

    Awesome! Now, lets edit our script that was for gravity.

    when green flag clicked
        set [Gravity v] to [0]
        forever
            wait (1) [milliseconds v]
            change [Gravity v] by (-0.25621)
            if <<(Cooldown) = [N]> and <key [space v] pressed?>> then
                set [Cooldown v] to [Y]
                set [Gravity v] to [6]
                change y by (2)
                repeat until <<touching (LevelGround v)?> or <(Gravity) = [0]>>
                    set [Cooldown v] to [N]
                    change [Gravity v] by (-0.25621)
                    set [Cooldown v] to [Y]
                end
                set [Cooldown v] to [N]
            endif
            if <touching (LevelGround v)?> then
                set [Gravity v] to [0]
            endif
        end
    end
    

    Awesome! Now, we have to make movement.

    Make these 2 when pressing a / d blocks!

    when [a v] key pressed
        repeat until <not <key [a v] pressed?>>
            change x by (-4)
        end
    end
    

    And

    when [d v] key pressed
        repeat until <not <key [d v] pressed?>>
            change x by (4)
        end
    end
    

    Awesome! Now, you can make your own custom levels, you should add a second sprite for the outline so that if you collide with it, you don’t go upwards, hope this helps!

    👋

    CreatiCodeI DreamSMP_LuckD 2 Replies Last reply
    1
    • NotJaldolfYTN NotJaldolfYT

      To copy all code easily, go to this project 😜 play.creaticode.com/projects/679240dfee3a4781a5afde57

      Today we are making a simple platformer game! Start by making the character sprite, you can make it a square, triangle, human, squirrel, alien, anything. Set your characters size to anything, for this, I’m going with 85. Use this code to make it!

      when green flag clicked
          set size to (100) %
      

      Nice!

      Now, lets add a simple gravity system. We’re going to have to add the “LevelGround” sprite, lets do it!

      After creating that sprite, you can use this code inside of “LevelGround” to make it go to the middle, make sure your character’s sprite is at the bottom of the boundary box for creating sprites, its fine for it to be outwards 😄

      when green flag clicked
          go to center
      

      Now, for the player, copy this script for basic gravity!

      when green flag clicked
          set [Gravity v] to [0]
          forever
              change [Gravity v] by (-0.2)
              if <key [space v] pressed?> then
                  set [Gravity v] to [6]
                  wait until <<not <key [space v] pressed?>> and <touching (LevelGround v)?>>
              endif
          end
      end
      

      Oh, no! Our players gravity is going down super fast! Let’s fix that!

      First, add a variable called: “Cooldown”, make this simple line:

      when green flag clicked
          set [Cooldown v] to [N]
      

      Awesome! Now, lets edit our script that was for gravity.

      when green flag clicked
          set [Gravity v] to [0]
          forever
              wait (1) [milliseconds v]
              change [Gravity v] by (-0.25621)
              if <<(Cooldown) = [N]> and <key [space v] pressed?>> then
                  set [Cooldown v] to [Y]
                  set [Gravity v] to [6]
                  change y by (2)
                  repeat until <<touching (LevelGround v)?> or <(Gravity) = [0]>>
                      set [Cooldown v] to [N]
                      change [Gravity v] by (-0.25621)
                      set [Cooldown v] to [Y]
                  end
                  set [Cooldown v] to [N]
              endif
              if <touching (LevelGround v)?> then
                  set [Gravity v] to [0]
              endif
          end
      end
      

      Awesome! Now, we have to make movement.

      Make these 2 when pressing a / d blocks!

      when [a v] key pressed
          repeat until <not <key [a v] pressed?>>
              change x by (-4)
          end
      end
      

      And

      when [d v] key pressed
          repeat until <not <key [d v] pressed?>>
              change x by (4)
          end
      end
      

      Awesome! Now, you can make your own custom levels, you should add a second sprite for the outline so that if you collide with it, you don’t go upwards, hope this helps!

      CreatiCodeI Offline
      CreatiCodeI Offline
      CreatiCode
      wrote on last edited by
      #2

      @jd131111

      Thank you for contributing to the community.

      I assume you got these pseudocode using the right-click menu’s “copy pseudocode” option, right?

      19a99a93-1554-4b40-89a1-4406fc9b88e1-image.png

      FYI, you can also use the “Export PNG Image” option above it, so that you get high quality block images. Of course, you can also use screen capture. Usually a block image is easier to read compared to the pseudocode for beginners.

      1 Reply Last reply
      2
      • NotJaldolfYTN Offline
        NotJaldolfYTN Offline
        NotJaldolfYT
        trusted helpers
        wrote on last edited by
        #3

        @info-creaticode Alright, thank you! 😄

        👋

        1 Reply Last reply
        1
        • NotJaldolfYTN NotJaldolfYT

          To copy all code easily, go to this project 😜 play.creaticode.com/projects/679240dfee3a4781a5afde57

          Today we are making a simple platformer game! Start by making the character sprite, you can make it a square, triangle, human, squirrel, alien, anything. Set your characters size to anything, for this, I’m going with 85. Use this code to make it!

          when green flag clicked
              set size to (100) %
          

          Nice!

          Now, lets add a simple gravity system. We’re going to have to add the “LevelGround” sprite, lets do it!

          After creating that sprite, you can use this code inside of “LevelGround” to make it go to the middle, make sure your character’s sprite is at the bottom of the boundary box for creating sprites, its fine for it to be outwards 😄

          when green flag clicked
              go to center
          

          Now, for the player, copy this script for basic gravity!

          when green flag clicked
              set [Gravity v] to [0]
              forever
                  change [Gravity v] by (-0.2)
                  if <key [space v] pressed?> then
                      set [Gravity v] to [6]
                      wait until <<not <key [space v] pressed?>> and <touching (LevelGround v)?>>
                  endif
              end
          end
          

          Oh, no! Our players gravity is going down super fast! Let’s fix that!

          First, add a variable called: “Cooldown”, make this simple line:

          when green flag clicked
              set [Cooldown v] to [N]
          

          Awesome! Now, lets edit our script that was for gravity.

          when green flag clicked
              set [Gravity v] to [0]
              forever
                  wait (1) [milliseconds v]
                  change [Gravity v] by (-0.25621)
                  if <<(Cooldown) = [N]> and <key [space v] pressed?>> then
                      set [Cooldown v] to [Y]
                      set [Gravity v] to [6]
                      change y by (2)
                      repeat until <<touching (LevelGround v)?> or <(Gravity) = [0]>>
                          set [Cooldown v] to [N]
                          change [Gravity v] by (-0.25621)
                          set [Cooldown v] to [Y]
                      end
                      set [Cooldown v] to [N]
                  endif
                  if <touching (LevelGround v)?> then
                      set [Gravity v] to [0]
                  endif
              end
          end
          

          Awesome! Now, we have to make movement.

          Make these 2 when pressing a / d blocks!

          when [a v] key pressed
              repeat until <not <key [a v] pressed?>>
                  change x by (-4)
              end
          end
          

          And

          when [d v] key pressed
              repeat until <not <key [d v] pressed?>>
                  change x by (4)
              end
          end
          

          Awesome! Now, you can make your own custom levels, you should add a second sprite for the outline so that if you collide with it, you don’t go upwards, hope this helps!

          DreamSMP_LuckD Offline
          DreamSMP_LuckD Offline
          DreamSMP_Luck
          trusted helpers
          wrote on last edited by
          #4

          @notjaldolfyt I love this! thank you jd 😄

          [■■■■■■■■■□] 90% now playing: at ease by ebaycarson

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • CreatiCode