Navigation

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

    Looking for help with array and randomness

    Help
    6
    20
    825
    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.
    • K
      kendog400 F last edited by

      Does Fuze have a Drop Shadow effect, like Photoshop ? (Just wondering)

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

        @kendog400 Your program only has a single sprite. When you change the animation and location of that sprite it just moves and changes that single sprite. If you are going to use sprites you need to have a sprite for each card in the pack. The easiest way to do that is to use an array of sprites. I have shared an example of this.

        The end function will not terminate your program it will just be called every time around the game loop. Instead you need to make your game loop conditional. Something like

        finished = false
        while !finished loop
          // set finished = true to end program
        repeat
        
        clear(lime)
        drawtext (120, 250, 180, black, "End of Deck")
        update()
        sleep(3)
        
        1 Reply Last reply Reply Quote 1
        • K
          kendog400 F last edited by

          OK, thanks, I'LL try this to see if I could get the program to end after the deck of cards is used up...

          1 Reply Last reply Reply Quote 0
          • K
            kendog400 F last edited by

            As for a drop shadow effect, mabey i could put a rectangle under the sprite, re-set the opacity, then add a blur... (?)

            1 Reply Last reply Reply Quote 2
            • K
              kendog400 F last edited by

              I tried, but it seems I dont know exactly where to put the while loop......I tried to replace the for loop with the command while....It must be some sloppiness on my part.....could you give me a hint ?......

              pianofire 2 Replies Last reply Reply Quote 0
              • pianofire
                pianofire Fuze Team @kendog400 last edited by

                @kendog400 Sorry very busy at the moment. I will take a look on Wednesday

                1 Reply Last reply Reply Quote 2
                • Dave
                  Dave Fuze Team last edited by

                  @kendog400 My friend code is 5139-4176-1902

                  Please add me as a Nintendo friend, share your project and I'll take a look today if I can!

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

                    @kendog400 OK I think that it is worth you looking at the 3 main different types of loop in Fuze: https://fuzearena.com/help/view/loop

                    1. Infinite (loop ... repeat) - this doesn't end until it is interrupted (as in your program)
                    2. Conditional (while condition loop ... repeat) - ends when the condition is met (e.g. the game has finished)
                    3. For (for index = start to end loop ... repeat) - ends when index > end

                    You wouldn't normally use 1) as it can only be ended by stopping the program.
                    You would use 2) when you want something to carry on until something happens
                    You would use 3) when you have a fixed amount of work to do

                    In your example you could use 3) because you have a fixed amount of work - you deal the cards and then your program finishes.

                    In reality your program will probably want to do something else after dealing the cards so you would have loops inside loops

                    Here is an example of a simple game loop (and possibly the worlds dullest game)

                    finished = false
                    
                    while !finished loop
                      gameScreen()
                      endScreen()   
                    repeat
                    
                    function gameScreen()
                      c = controls(0)
                      while !c.a loop
                        clear()
                        c = controls(0)
                        printAt(0, 0, "Game Screen. Press A to exit")  
                        update()
                      repeat
                    return void
                    
                    function endScreen()
                      c = controls(0)
                      while !c.x and !c.y loop
                        clear()
                        c = controls(0)
                        printAt(0, 0, "End Screen. Press Y to play again and X to exit")  
                        update()
                      repeat
                      finished = c.x
                    return void
                    
                    QIsLegit 1 Reply Last reply Reply Quote 3
                    • QIsLegit
                      QIsLegit F @pianofire last edited by

                      @pianofire
                      Is there no way to break out of an 'infinite loop' using code?

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

                        @QIsLegit OK yes there is. You can use the break command but it is not good practice https://fuzearena.com/help/view/break

                        loop
                          c = controls(0)
                          if c.a then
                            break
                          endif
                          update()
                        repeat
                        
                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post