Looking for help with array and randomness
-
Does Fuze have a Drop Shadow effect, like Photoshop ? (Just wondering)
-
@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)
-
OK, thanks, I'LL try this to see if I could get the program to end after the deck of cards is used up...
-
As for a drop shadow effect, mabey i could put a rectangle under the sprite, re-set the opacity, then add a blur... (?)
-
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 ?......
-
@kendog400 Sorry very busy at the moment. I will take a look on Wednesday
-
@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!
-
@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
- Infinite (loop ... repeat) - this doesn't end until it is interrupted (as in your program)
- Conditional (while condition loop ... repeat) - ends when the condition is met (e.g. the game has finished)
- 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 doIn 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
-
@pianofire
Is there no way to break out of an 'infinite loop' using code? -
@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