Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Specific sprite movement

    Beginners
    8
    27
    1328
    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.
    • LinkCraft
      LinkCraft F last edited by LinkCraft

      So I got it to kind of work but there one issue. So it compares the rotation of the sprite to the position of the joystick and if the joystick is greater then it adds to the rotation of the sprite and it subtracts when it’s less but when it gets to 360 degrees and goes to 1 degree it turns all the way around in the wrong direction

      CasualTie5 1 Reply Last reply Reply Quote 1
      • CasualTie5
        CasualTie5 F @LinkCraft last edited by

        @LinkCraft ok, that's confusing... maybe it has to do with the "end" of the circle (i.e. going back to 1 from 360)? I'm afraid I have no idea how to fix that though

        1 Reply Last reply Reply Quote 1
        • LinkCraft
          LinkCraft F last edited by

          Lol I’ll probably have to to something else thanks for the help though

          waldron vinicity DomDom 3 Replies Last reply Reply Quote 1
          • waldron
            waldron F @LinkCraft last edited by

            @LinkCraft have you tried setspriteorigin to move the axis

            1 Reply Last reply Reply Quote 1
            • vinicity
              vinicity F @LinkCraft last edited by vinicity

              @LinkCraft said in Specific sprite movement:

              Lol I’ll probably have to to something else thanks for the help though

              Could you friend share your code? It’s easier to spot the problem then...

              1 Reply Last reply Reply Quote 0
              • DomDom
                DomDom F @LinkCraft last edited by DomDom

                This post is deleted!
                LinkCraft 1 Reply Last reply Reply Quote 1
                • LinkCraft
                  LinkCraft F @DomDom last edited by

                  I made some changes to make it easer to understand but this is what I’m at so far

                  It sucks to get stuck in making a game from so early on lol

                  Planespeed = 10
                  Pr=0
                  Planeimg = loadimage(“plane”)
                  
                  Plane=createsprite()
                  Setspriteimage(plane,planeimg)
                  Setspritelocation(plane,gwidth()/2,gheight()/2)
                  Setspritesvale(plane,{2,2})
                  
                  Loop
                  Clear(skyblue)
                  C=controls(0)
                  
                  If (atan2(c.lx,c.ly)) < pr then
                  Pr-=5
                  Endif
                  
                  If (atan2(c.lx,c.ly)) > pr then
                  Pr+=5
                  Endif
                  
                  Setspriterotation(plane,Pr)
                  
                  Drawsprites()
                  
                  Update()
                  Repeat
                  
                  1 Reply Last reply Reply Quote 1
                  • LinkCraft
                    LinkCraft F last edited by

                    I’m trying to make a game like Man vs. Missiles if that helps.

                    1 Reply Last reply Reply Quote 1
                    • PickleCatStars
                      PickleCatStars F last edited by

                      https://www.helixsoft.nl/articles/circle/sincos.htm

                      1 Reply Last reply Reply Quote 1
                      • PickleCatStars
                        PickleCatStars F last edited by

                        You’ll probably want a ’desiredAngle’, ’currentAngle’, and ’turnspeed’ variables for your plane. It shouldn’t be too crazy hard to get it turning the right way. I bet there’s a smart-ass one-line trick that programmers know, but don’t worry if you figure out a dumb long clumsy way - as long as it works :)

                        1 Reply Last reply Reply Quote 1
                        • LinkCraft
                          LinkCraft F last edited by

                          I don’t care if it’s 100 lines I just want it to work Lol. I’ll check that link out later today Almost all websites are blocked on my phone (thankfully not fuze arena) and my dad uses the computer for work all day so I just have to wait until he’s done. :)

                          1 Reply Last reply Reply Quote 1
                          • DomDom
                            DomDom F last edited by

                            This post is deleted!
                            vinicity 1 Reply Last reply Reply Quote 3
                            • LinkCraft
                              LinkCraft F last edited by LinkCraft

                              @DomDom
                              Is that working?

                              1 Reply Last reply Reply Quote 0
                              • DomDom
                                DomDom F last edited by

                                This post is deleted!
                                1 Reply Last reply Reply Quote 2
                                • LinkCraft
                                  LinkCraft F last edited by

                                  Ok perfect all give it a go thanks so much

                                  1 Reply Last reply Reply Quote 1
                                  • vinicity
                                    vinicity F @DomDom last edited by

                                    @DomDom Could you please just explain the code a little bit, and especially the use of the dot product?

                                    I know it’s something I was taught in school, but it’s all a bit hazy...

                                    1 Reply Last reply Reply Quote 0
                                    • DomDom
                                      DomDom F last edited by DomDom

                                      This post is deleted!
                                      1 Reply Last reply Reply Quote 2
                                      • vinicity
                                        vinicity F last edited by

                                        Thanks a lot! I have been wrestling with vectors these last few nights, and the dot product seems to actually be able to solve a few a my problems.

                                        Great explanation!

                                        1 Reply Last reply Reply Quote 2
                                        • LinkCraft
                                          LinkCraft F last edited by

                                          Starting to have a game come along!!! Thanks for the help :)

                                          image.jpg

                                          1 Reply Last reply Reply Quote 6
                                          • DomDom
                                            DomDom F last edited by

                                            This post is deleted!
                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post