Trying to figure out Video Poker Game
-
/* I'm trying to figure out if Fuze has a Garbage Fx like the Lua programming langauge.. I need to select 2 cards (mabey 1), and get rid of them. I might be able to use setSpriteVisibility and set this to false(off) for the two cards.. I,m thinking I may be able to use the same for loop that I used to place the 1st 5 cards on the screen and place two more cards on the screen using the cards [ i ] variable.. If I could just get this right, I can get a roll on and keep making more card games.. This business needs constant new fresh material (games)...Below is the PGM, but it stills needs work....*/
// set up starting variables............ clear(darkGreen) // turn background green image = loadImage ("Kenney/boardgames") // load sprite sheet suits = ["clubs", "diamonds", "hearts", "spades"] // set array for suits array cards [52} // set array for deck x = 50 // set starting point for 1st card along x axis y = 200 // set starting point for 1st card along y axis cardHeld = [0,0,0,0,0] // set array for cards being held selectCard = 0 // set a varible for card(s) set to be discarded j = controls // set up joycon controls z = 0 // setup a varible for new cards to be drawn getPack ( ) shufflePack ( ) //..................................................................................... // Deal 5 cards to the screen.................. for i = 0 to 5 loop sprite = cards [ i ] size = getSpriteSize (sprite) setSpriteLocation (sprite, x, y) x += 236 // move the next card over along the x axis setSpriteDepth(sprite, -1) // deal the cards in the order that was picked setSpriteVisibility(sprite, true) drawSprites ( ) update ( ) sleep(0.7) repeat //................................................................................................. function shufflePack ( ) cardIndex1 = random (52) cardIndex2 = random (52) card1 = cards [cardIndex1] card2 = cards [cardIndex2] cards [cardIndex1] = card2 cards [cardIndex2] = card1 repeat return void //.......................................................................................... function getPack ( ) values = [ [0,"2"], [1,"3"], [2,"4"], [3,"5"], [4,"6"], [5,"7"], [6,"8"], [7,"9"], [8,"10"], [12,"A"], [9,"J"], [11,"K"], [10,"Q"], ] imageNo = 0 for suitNo = 0 to 4 loop for valueNo = 0 to 13 loop cardNo = suitNo * 13 values[valueNo] [0] sprite = createSprite ( ) cardImage = getImage (imageNo) setSpriteImage(sprite, cardImage) setSpriteVisibilty(sprite, false) setSpriteDepth(sprite, cardNo) size = getSpriteSize(sprite) setSprieOrgin(sprite, -size,x/2, -size.y/2) scale = 1.5 setSpriteScale ( sprite, {scale, scale} ) sprite.value = values [valueNo] [1] sprite.suit = suits [suitNo] sprite.imageNo = imageNo cards [cardNo] = sprite imageNo + = 1 if imageNo = 39 then imageNo + = 1 endif repeat repeat return void //.............................................................................................. function getImage (imageNo) cardImage = createImage(140, 190, false, image_rgb) setDrawTarget (cardImage) drawSheet(image, imageNo + 15, {0, 0, 140, 190} ) update ( ) return cardImage //.......................................................................... // button control section while ! j.y loop // when y is pressed, draw new card(s) if j.left then // move to the left selectCard -= 1 sleep(.5) endif if j.right then // move to the right selectCard += 1 sleep(.5) endif if selectedCard < 0 then // from the 1st card, go to the last card selectedCard = 4 sleep(.5) endif if selectedCard > 4 then // from the 5th card, go to the 1st card selectedCard = 0 sleep(.5) endif if j.a then if cardHeld [selectedCard] == 0 then if cardHeld [selectedCard] == 1 else if cardHeld [selectedCard] == 0 endif sleep(.5) endif //............................................................................. for z = 0 to 5 loop if cardHeld [z] ==0 then drawCard ( ) endif repeat //.....................................................................