Navigation

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

    2 sprites 1 player

    Beginners
    6
    24
    1238
    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.
    • waldron
      waldron F last edited by

      started animating the bots(sprites) ....
      is their a preference to loading them in e.g.

      createsprites()
      or
      loadImage=(image...)

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

        @waldron said in 2 sprites 1 player:

        started animating the bots(sprites) ....
        is their a preference to loading them in e.g.

        createsprites()
        or
        loadImage=(image...)
        chrsheet=

        joinShapes() would i use this to join my 2 sprites together?

        1 Reply Last reply Reply Quote 0
        • Martin
          Martin Fuze Team last edited by

          No, that’s for primitives not sprites.

          There is no built in concept of joining sprites into bigger sprites. You simply need to track the fact they are in a joined state and move their X / Y coordinates together

          1 Reply Last reply Reply Quote 4
          • waldron
            waldron F last edited by

            still struggling with this iv managed to get 2 sprites on screen but then i broke it
            am i doubling up on code and which code, drawsheet ect
            img1 = loadimage (blah)
            img2 = loadimage (blah)

            location ......
            location...

            global scale.....

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

              @waldron said in 2 sprites 1 player:

              still struggling with this iv managed to get 2 sprites on screen but then i broke it
              am i doubling up on code and which code, drawsheet ect
              img1 = loadimage (blah)
              img2 = loadimage (blah)

              location ......
              location...

              global scale.....

              any method of getting 2 sprites on screen would be a great help

              pianofire 1 Reply Last reply Reply Quote 0
              • pianofire
                pianofire Fuze Team @waldron last edited by

                @waldron This example has several https://fuzearena.com/help/view/updateSprites

                waldron 1 Reply Last reply Reply Quote 2
                • waldron
                  waldron F @pianofire last edited by

                  @pianofire il have a look later cheers was wanting to use it for a pinball game just figuring out the flippers

                  waldron 1 Reply Last reply Reply Quote 1
                  • waldron
                    waldron F @waldron last edited by

                    @waldron said in 2 sprites 1 player:

                    @pianofire il have a look later cheers was wanting to use it for a pinball game just figuring out the flippers

                    nevermind just had a brain wave

                    1 Reply Last reply Reply Quote 0
                    • Martin
                      Martin Fuze Team last edited by

                      I don't know if there is any confusion here on the terminology of sprites vs. images? But both, while different are trivial to have lots of them on screen at once.

                      This will be psuedo-code since I'm not at a switch right now...

                      2 actual images on screen at once:

                      bill = loadImage("bill")
                      ben = loadImage("ben")
                      loop
                          clear()
                          drawImage(bill, x, y, etc.)
                          drawImage(ben, x, y, etc.)
                          update()
                      repeat
                      

                      2 Sprites on screen at once:

                      bill_img = loadImage("bill")
                      ben_img = loadImage("ben")
                      bill = createSprite()
                      ben = createSprite()
                      setSpriteImage(bill, bill_img)
                      setSpriteImage(ben, ben_img)
                      
                      loop
                          clear()
                          setSpriteLocation(bill, x, y)
                          setSpriteLocation(ben, x, y)
                          updateSprites()
                          drawSprites()
                          update()
                      repeat
                      

                      Again, none of those functions have complete arguments, or the right arguments, please look the commands up in the help.

                      But that's two differemt methods of getting 2 "sprites" on screen at once - most programs have many on screen at once. There are other ways too because you can create your own images in code and you can also draw images onto another image which is then ultimately rendered to the frame buffer.

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

                        I got to grips with it last night with them both controlled simultaneously:) this will also help so I can tidy up my code thanks man

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