Navigation

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

    Remove sprite not working?

    Help
    5
    9
    265
    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.
    • poof92
      poof92 last edited by

      After I load another map It says remove sprite operation cannot be do or something along those lines how do I do this?

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

        I tried to use remove sprite and although it did remove the sprite it messed up my others (because I had multiple copies of it)
        I found the best method is to simply move the sprite off screen. to something like setspritelocation(mysprite,-500,0)

        Hope that helps, sorry if it doesn't but I'm sure the experts will be along to help you soon.

        1 Reply Last reply Reply Quote 1
        • poof92
          poof92 last edited by

          Actually that's great thanks.

          1 Reply Last reply Reply Quote 0
          • Electric Dreams
            Electric Dreams F last edited by

            Not so great for the memory use...
            even if we have enough
            In any case, it shocks the coder in me ...

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

              @Electric-Dreams Steve has a fixed sized array of sprites that live throughout the lifetime of the program. So memory usage is static. Also, all removed sprites are eventually put back again at the start of the next level, or game.

              To the original problem, you can do something along these lines - it has worked for me in the past, if it doesn't now then I'd like a small code sample to test.

              nullSprite = createSprite().   // Do nothing with this sprite
              
              // create all the sprites you desire - but let's say we have one called player
              
              removeSprite(player)
              player = nullSprite
              
              // Everything carries on as it should
              
              1 Reply Last reply Reply Quote 1
              • Electric Dreams
                Electric Dreams F last edited by

                fixed sized array : ok, no memory problem !

                In the futures updates, will we have any fonctions to dynamicly manage the array ?
                What I mean ?
                Removing any piece of an array and adding other ones.
                For exemple, an enemy who get out screen should be remove of the array, and we could add some other as le difficulty grows.

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

                  You can add elements now, there are other posts on the subject.

                  1 Reply Last reply Reply Quote 0
                  • R
                    Richard F last edited by Richard

                    You can add elements, but can you remove elements? I wanted a stack type structure and ended up using a variable to keep track of the last relevant piece of information in my array and decreasing it each time I really wanted to remove an element from the end of the array. I don't imagine this was the most efficient method, but it worked.

                    1 Reply Last reply Reply Quote 0
                    • Electric Dreams
                      Electric Dreams F last edited by

                      Yes adding is possible, I already do it on my snake game when the snake grow.

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