1. Re: (IRV's reponse)Help With My Game of Black Jack

> Once again thanks for your input. I just need to clarify some things that
> you wrote me.
> This below is what loads the card images right? When I run this I get some
> errors. Like "deck has not been declared. Would I declare that as an
object
> or an atom?

deck could be either a sequence or an object.  I probably would call it an
object,
since it will contain "cards" not text or numbers.
object deck
> ---------------------------------------------------
> deck = {}
> for card = 1 to 52 do -- cards images will be in 1.bmp, 2,bmp, 3.bmp.....
>  image = read_bitmap(sprintf("%d.bmp",card))
>  deck = append(deck,image[2]) -- throw away the palette info.
> end for
> --------------------------------------------------
> Now if that's the case.... Let's start simple. I'm really new to
programing
> in general not just Euphoria. I got your post about the quotes. We'll
> ignore that for now. Forget the actual game for now. How would I take the
> loaded images and display them clicking on the "Hit Me" button.

Drop a pushbutton onto your form, then double click the button. That will
open
the code editor to the button's onClick response. You'll see something like:
procedure Pushbutton1_onClick()
end procedure

add code inside the procedure to: 1. draw a new card, and 2. display the
hand.
So it will look something like:
procedure Pushbutton1_onClick()
hand = append(hand,draw(1)) -- draw one card and add it to the player's
hand.
Show(hand)
end procedure

Note that the Show procedure as written displays the cards in a fixed
location.
If you have more than one player, you'll probably want to pass a different
location for
each player's hand to the Show procedure, along with the contents of his
hand.

That means you need to modify the parameters of the Show() procedure
slightly:
procedure Show(sequence coords, object hand)
for i =1 to length(hand) do
  display_image(coords,hand[i]) -- goto coords,and display the first card
  coords += {20,30} -- move down and to the right before showing the next
card
end for
end procedure

so your call to Show would now be: Show({10,20},hand)

Hope that helps,
Irv

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu