Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Set rotation speed for "motion" category

    Feedback
    3
    18
    627
    Loading More Posts
    • 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.
    • The_True_Odst
      The True ODST Best Forum Helpers last edited by

      dcad87e3-1f86-4620-a0c5-776dd1a2f300-image.png

      There should be a rotation speed for the motion category when sprites point at objects that could potentially move. I think this would be an easy way for them to demonstrate top-down weight physics

      ODST: Orbital Drop Ship Trooper
      (Halo Reference)

      Tyller_ info-creaticode 2 Replies Last reply Reply Quote 0
      • Tyller_
        Tyller_ Best Forum Helpers @The_True_Odst last edited by

        @011830-0a42ef84 you could have instead when it turns to face an object, you caclulate the direction it’ll go and if that direction is higher than the rotation speed, turn the rotation speed, but if it’s less you just turn the direction. Also top down physics are quite possible with gravity being 0

        <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
        </div>

        The_True_Odst 1 Reply Last reply Reply Quote 0
        • The_True_Odst
          The True ODST Best Forum Helpers @Tyller_ last edited by The_True_Odst

          @tyller_ I tried, but I’m bad at the physics stuff. I work with the original category blocks.


          Also, I need a visual on what you said otherwise it doesn’t make much sense to me anyways

          ODST: Orbital Drop Ship Trooper
          (Halo Reference)

          Tyller_ 1 Reply Last reply Reply Quote 0
          • Tyller_
            Tyller_ Best Forum Helpers @The_True_Odst last edited by

            @011830-0a42ef84 IMG_0053.jpeg
            It may seem a little complex, but I can explain it all if you want

            <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
            </div>

            The_True_Odst 1 Reply Last reply Reply Quote 1
            • The_True_Odst
              The True ODST Best Forum Helpers @Tyller_ last edited by The_True_Odst

              @tyller_ Well, right now on my tower defense game, I need help with measuring if there are no enemies on the screen, then a trigger will happen where everything stops firing. It’s set up to where the enemies will keep firing forever if they sense an enemy, but it’s bugged to where the game will only sense “no enemies” when the wave ends.

              Nevermind I fixed it

              ODST: Orbital Drop Ship Trooper
              (Halo Reference)

              Tyller_ 1 Reply Last reply Reply Quote 0
              • Tyller_
                Tyller_ Best Forum Helpers @The_True_Odst last edited by

                @011830-0a42ef84 you can add a counter for how many enemies have spawned that goes up when they spawn and down when they exit/get shot

                <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
                </div>

                1 Reply Last reply Reply Quote 0
                • info-creaticode
                  CreatiCode @The_True_Odst last edited by

                  @011830-0a42ef84

                  Can you explain a bit more what’s this new block would do? Is it a speed limit on how fast the object can rotate?

                  Do you think you can try to calculate how many degrees the object will rotate in total? If so, then you can calculate how long it should take based on the desired rotation speed, then you can use the following block to do the rotation:

                  2f19bfad-7b2a-49e0-8b20-4fabad098cc4-image.png

                  The_True_Odst 1 Reply Last reply Reply Quote 0
                  • The_True_Odst
                    The True ODST Best Forum Helpers @info-creaticode last edited by

                    @info-creaticode Yes but I need to target a continuously moving object.

                    ODST: Orbital Drop Ship Trooper
                    (Halo Reference)

                    Tyller_ info-creaticode 2 Replies Last reply Reply Quote 0
                    • Tyller_
                      Tyller_ Best Forum Helpers @The_True_Odst last edited by

                      @011830-0a42ef84 are you sure you want them to turn at a limited speed? you should just have them point towards the object at all times in the context of tower defense, turn speed isn’t really something to have (especially without projectile collision stuff)

                      <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
                      </div>

                      The_True_Odst 1 Reply Last reply Reply Quote 0
                      • info-creaticode
                        CreatiCode @The_True_Odst last edited by

                        @011830-0a42ef84

                        Can you share the project? Are you saying the target object is moving, and your sprite keeps rotating to face that target, but you don’t want your sprite to rotate too fast?

                        The_True_Odst 1 Reply Last reply Reply Quote 0
                        • The_True_Odst
                          The True ODST Best Forum Helpers @Tyller_ last edited by

                          @tyller_ yes, but some units have heavier weapons like the mini gun, there-fore harder turning speed

                          ODST: Orbital Drop Ship Trooper
                          (Halo Reference)

                          Tyller_ 1 Reply Last reply Reply Quote 0
                          • Tyller_
                            Tyller_ Best Forum Helpers @The_True_Odst last edited by

                            @011830-0a42ef84 the issue is you’ll need projectile/bullet speed first (or just detections on if a unit is pointing at an enemy so when it shoots it should actually damage an enemy)

                            <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
                            </div>

                            1 Reply Last reply Reply Quote 0
                            • The_True_Odst
                              The True ODST Best Forum Helpers @info-creaticode last edited by

                              @info-creaticode https://play.creaticode.com/projects/6730fb66bf68856fe9840816

                              ODST: Orbital Drop Ship Trooper
                              (Halo Reference)

                              info-creaticode 1 Reply Last reply Reply Quote 0
                              • info-creaticode
                                CreatiCode @The_True_Odst last edited by

                                @011830-0a42ef84

                                Thanks. So, which sprite and which code blocks for that sprite are you trying to improve?

                                The_True_Odst 1 Reply Last reply Reply Quote 0
                                • The_True_Odst
                                  The True ODST Best Forum Helpers @info-creaticode last edited by

                                  @info-creaticode On the minigun and launcher units, their turning automatically points to the fastest enemy. I would like there to be a turning time that is slower than just automatically pointing at them.

                                  I would also like to know how for units to point at the first enemy, not just the fastest one.

                                  ODST: Orbital Drop Ship Trooper
                                  (Halo Reference)

                                  info-creaticode 1 Reply Last reply Reply Quote 0
                                  • info-creaticode
                                    CreatiCode @The_True_Odst last edited by

                                    @011830-0a42ef84

                                    Can you add some instructions in the project cover page to explain how to play the game? What are the keyboard or mouse controls?

                                    The_True_Odst 1 Reply Last reply Reply Quote 0
                                    • The_True_Odst
                                      The True ODST Best Forum Helpers @info-creaticode last edited by The_True_Odst

                                      @info-creaticode The instructions are in the actual game, since that version is the test room, so it doesn’t include instructions

                                      I moved the test room’s download to the actual one, you should see the instructions in that one.

                                      https://play.creaticode.com/projects/672e66b5731b37123597e815

                                      ODST: Orbital Drop Ship Trooper
                                      (Halo Reference)

                                      info-creaticode 1 Reply Last reply Reply Quote 0
                                      • info-creaticode
                                        CreatiCode @The_True_Odst last edited by

                                        @011830-0a42ef84

                                        This is a fun game.

                                        So let’s solve one problem at a time. To limit the rotation speed, you can try to use a loop to repeatedly rotate the sprite a little bit towards the target’s direction.

                                        Here is a demo project:

                                        play.creaticode.com/projects/67351d4fef35162a42f8bc50

                                        As you can see, in a forever loop, we take 3 steps:

                                        1. calculate angle difference between current direction and the desired direction
                                        2. normalize that difference to within -180 and 180
                                        3. rotate for up to the speed limit

                                        This is what you will get as you move the mouse:

                                        speedlimit.gif

                                        1 Reply Last reply Reply Quote 1
                                        • First post
                                          Last post