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. Tutorial: Gravity without 2D Physics

Tutorial: Gravity without 2D Physics

Scheduled Pinned Locked Moved General Discussion
3 Posts 2 Posters 1.4k Views 2 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.
  • silvloveS Offline
    silvloveS Offline
    silvlove
    Mod Helper
    wrote on last edited by silvlove
    #1

    removeable: yes I know that physics blocks exist but this is for users (like me) that don’t know how to use them.

    Does your gravity look like this?
    Screenrecording2024-09-0420.04.32-ezgif.com-video-to-gif-converter.gif

    Don’t you wish it could look like this without the use of 2D Physics blocks?
    Screenrecording2024-09-0420.56.38-ezgif.com-video-to-gif-converter.gif
    Well, I can show you how! First, you need to select a sprite!
    I’ll choose a white squircle.

    Then you need a Level sprite! I will just use a square. Alright, let’s get to coding! First we need a

    when green flag clicked
    

    block!
    Now we need a forever loop! It should look something like this:
    Screenshot 2024-09-04 20.13.47.png

    We should make a Gravity variable, and don’t forget to start off with Gravity being 0!
    Here’s what I did:
    Screenshot 2024-09-04 20.20.03.png

    Now don’t forget to add collision!
    Screenshot 2024-09-04 20.24.33.png

    This didn’t quite work. Let’s fix that!
    Screenshot 2024-09-04 20.45.54.png
    Perfect! Now we need a key to press to start it! I’ll use Space Bar.
    Screenshot 2024-09-04 20.48.05.png
    Uh oh! The player can jump indefinitely! Let’s fix that!
    Screenshot 2024-09-04 20.53.03.png

    Good job! You just made basic, but customizable Gravity!
    It’s a bit buggy, but it works! If you know how to fix some issues, please contact me by making a new topic with the title; “RE: Tutorial: Gravity without 2D Physics”, and you may tag me as well.

    I hope you found this tutorial useful, and I might make some more!

    Forums Moderator.
    Trans girl :3 ~ 14yo
    Friendly and sometimes goofy~!

    JaecadeJnightJ 1 Reply Last reply
    4
    • silvloveS silvlove

      removeable: yes I know that physics blocks exist but this is for users (like me) that don’t know how to use them.

      Does your gravity look like this?
      Screenrecording2024-09-0420.04.32-ezgif.com-video-to-gif-converter.gif

      Don’t you wish it could look like this without the use of 2D Physics blocks?
      Screenrecording2024-09-0420.56.38-ezgif.com-video-to-gif-converter.gif
      Well, I can show you how! First, you need to select a sprite!
      I’ll choose a white squircle.

      Then you need a Level sprite! I will just use a square. Alright, let’s get to coding! First we need a

      when green flag clicked
      

      block!
      Now we need a forever loop! It should look something like this:
      Screenshot 2024-09-04 20.13.47.png

      We should make a Gravity variable, and don’t forget to start off with Gravity being 0!
      Here’s what I did:
      Screenshot 2024-09-04 20.20.03.png

      Now don’t forget to add collision!
      Screenshot 2024-09-04 20.24.33.png

      This didn’t quite work. Let’s fix that!
      Screenshot 2024-09-04 20.45.54.png
      Perfect! Now we need a key to press to start it! I’ll use Space Bar.
      Screenshot 2024-09-04 20.48.05.png
      Uh oh! The player can jump indefinitely! Let’s fix that!
      Screenshot 2024-09-04 20.53.03.png

      Good job! You just made basic, but customizable Gravity!
      It’s a bit buggy, but it works! If you know how to fix some issues, please contact me by making a new topic with the title; “RE: Tutorial: Gravity without 2D Physics”, and you may tag me as well.

      I hope you found this tutorial useful, and I might make some more!

      JaecadeJnightJ Offline
      JaecadeJnightJ Offline
      JaecadeJnight
      Mod Helper
      wrote on last edited by
      #2

      @106809nes oh cool, this is what you normally do in Scratch. Basically just gotta check forever if the player is not touching the ground. If not, you have to change y by a negative value like -0.5 until they are touching the ground. Good tutorial tho

      #LLJW
      <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

      silvloveS 1 Reply Last reply
      2
      • JaecadeJnightJ JaecadeJnight

        @106809nes oh cool, this is what you normally do in Scratch. Basically just gotta check forever if the player is not touching the ground. If not, you have to change y by a negative value like -0.5 until they are touching the ground. Good tutorial tho

        silvloveS Offline
        silvloveS Offline
        silvlove
        Mod Helper
        wrote on last edited by silvlove
        #3

        @jeffreyrb03-gmail
        Thanks! I do this a lot for quick and simple projects, but for big games like mine, I make usable, completely customizable, non-buggy gravity.

        Forums Moderator.
        Trans girl :3 ~ 14yo
        Friendly and sometimes goofy~!

        1 Reply Last reply
        3
        • silvloveS silvlove locked this topic on

        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