lot of things ig. Lastly made function also show the card on passed coordinates. Coordinates are not getting passed over yet in blackjack.lua. It isnt testet also lol
This commit is contained in:
@@ -1,38 +1,42 @@
|
||||
local love = require "love"
|
||||
require "karten"
|
||||
|
||||
spielerHand = {}
|
||||
dealerHand = {}
|
||||
deck = {}
|
||||
DealerHand = {}
|
||||
Deck = {}
|
||||
|
||||
function loadBlackjack()
|
||||
deck = createDeck()
|
||||
shuffleDeck(deck)
|
||||
dealInitialCards()
|
||||
function LoadBlackjack()
|
||||
Deck = Karten:createDeck()
|
||||
Karten:shuffleDeck(Deck)
|
||||
DealInitialCards()
|
||||
Cards = love.graphics.newImage("/cards_asset_pack/CuteCards.png")
|
||||
end
|
||||
|
||||
function updateBlackjack(dt)
|
||||
function UpdateBlackjack(dt)
|
||||
-- Hier können zukünftige Updates für Blackjack hinzugefügt werden
|
||||
end
|
||||
|
||||
function drawBlackjack()
|
||||
love.graphics.print("Spieler Hand: " .. handValue(spielerHand), 50, 50)
|
||||
love.graphics.print("Dealer Hand: " .. handValue(dealerHand), 50, 100)
|
||||
love.graphics.print("Drücke 'H' für Hit oder 'S' für Stand", 50, 150)
|
||||
function DrawBlackjack()
|
||||
print(love.graphics:getWidth())
|
||||
love.graphics.draw(Cards, love.graphics.getWidth() / 2 - 90 , 50, 0, 0.2)
|
||||
-- love.graphics.print("Spieler Hand: " .. Karten:handValue(spielerHand), 50, 50)
|
||||
-- love.graphics.print("Dealer Hand: " .. Karten:handValue(DealerHand), 50, 100)
|
||||
-- love.graphics.print("Drücke 'H' für Hit oder 'S' für Stand", 50, 150)
|
||||
end
|
||||
|
||||
function handleBlackjackInput(key)
|
||||
function HandleBlackjackInput(key)
|
||||
if key == 'h' then
|
||||
hit(spielerHand)
|
||||
if handValue(spielerHand) > 21 then
|
||||
Karten:hit(spielerHand)
|
||||
if Karten:handValue(spielerHand) > 21 then
|
||||
love.graphics.print("Spieler hat verloren!", 50, 200)
|
||||
end
|
||||
elseif key == 's' then
|
||||
while handValue(dealerHand) < 17 do
|
||||
hit(dealerHand)
|
||||
while Karten:handValue(DealerHand) < 17 do
|
||||
Karten:hit(DealerHand)
|
||||
end
|
||||
if handValue(dealerHand) > 21 then
|
||||
if Karten:handValue(DealerHand) > 21 then
|
||||
love.graphics.print("Dealer hat verloren!", 50, 200)
|
||||
elseif handValue(spielerHand) > handValue(dealerHand) then
|
||||
elseif Karten:handValue(spielerHand) > Karten:handValue(DealerHand) then
|
||||
love.graphics.print("Spieler gewinnt!", 50, 200)
|
||||
else
|
||||
love.graphics.print("Dealer gewinnt!", 50, 200)
|
||||
@@ -40,10 +44,10 @@ function handleBlackjackInput(key)
|
||||
end
|
||||
end
|
||||
|
||||
function dealInitialCards()
|
||||
function DealInitialCards()
|
||||
for i = 1, 2 do
|
||||
hit(spielerHand)
|
||||
hit(dealerHand)
|
||||
Karten:hit(spielerHand)
|
||||
Karten:hit(DealerHand)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user