function Muovi( nWidth,nHeight )
Local oSprite
cardmap:= "Back"
@ 0, 0 BITMAP oSprite;
RESOURCE cardmap;
PIXEL NOBORDER
oSprite:ltransparent:=.t.
sleep(20)
nxPos := 650
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 600
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 580
nYPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 540
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 520
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 500
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 480
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 440
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 420
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 400
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 380
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 340
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 320
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 300
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 280
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 240
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
return nil
#include "fivewin.ch"
#include "constant.ch"
#define TXT_GAME "EasyBlackJack"
#define TXT_RELEASE "1.00"
FUNCTION BlackJack()
LOCAL i
Local nBottom := 42
Local nRight := 99
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
oImagen = TImage():Define("PANNOBLACK", )
DEFINE DIALOG oDlg21 ;
TITLE TXT_GAME +" "+ TXT_RELEASE ;
SIZE nWidth, nHeight
oDlg21:bPainted := {|hDC| PalBmpDraw( hDC, 0, 0, oImagen:hBitmap,, oDlg21:nWidth, oDlg21:nHeight,, .T.) }
ACTIVATE DIALOG oDlg21 CENTERED ;
ON INIT (BuildMenu(nWidth,nHeight))
RETURN NIL
Function BuildMenu(nWidth,nHeight)
MENU oMenu 2015
MENUITEM "&Info"
MENU
MENUITEM "Cards" action Presentazione(nWidth,nHeight)
ENDMENU
ENDMENU
oDlg21:SetMenu(oMenu)
RETURN NIL
Function Presentazione(nWidth,nHeight)
Muovi(nWidth,nHeight)
return nil
function Muovi( nWidth,nHeight )
Local oSprite
cardmap:= "Back"
@ 0, 0 BITMAP oSprite;
RESOURCE cardmap;
PIXEL NOBORDER
oSprite:ltransparent:=.t.
sleep(20)
nxPos := 650
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 600
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 580
nYPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 540
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 520
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 500
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 480
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 440
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 420
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 400
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 380
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 340
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 320
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 300
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 280
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
sleep(20)
nxPos := 240
nyPos := 80
oSprite:Move( nYPos, nXPos, , , .T. )
return nil
FUNCTION CardMove(cCardName, nTDI, nTPI, nLl, nCard, lDealer)
// FUNCTION CardMove(
//CardName,
//Top dealer,
//Top player,
//left start position,
//nCard,
//dealer or player)
* Local oSprite[nCard]
local cardmap
Local G := 46, H := 41, I := 1, J := 1
IF ccardname = 0
cardmap := c_path1 + "Back.bmp"
ELSE
cardmap := c_path1 + "card" +alltrim(str(ccardname)) + ".bmp"
Endif
@ 0,0 IMAGE oSprite[nCard] FILENAME CardMap NOBORDER
oSprite[nCard]:lTransparent := .T.
oSprite[nCard]:Hide()
IF lDealer = .T. // DEALER movement HORIZONTAL top / right to top / left
FOR I := 1 TO 1
FOR J := 1 to G
nLl-= 10
oSprite[nCard]:Show()
oSprite[nCard]:Move ( nTDI,nLl,,,.t.)
oSprite[nCard]:Refresh()
SYSWAIT1(0.01)
NEXT
nLl := 660
G -= 8
NEXT
ELSE // PLAYER movement VERTICAL from top / right to bottom / left
nLl := 660
FOR I := 1 TO 1
FOR J := 1 to H
nLl-= 10
oSprite[nCard]:Show()
oSprite[nCard]:Move ( nTDI+= 8,nLl,,,.t.)
oSprite[nCard]:Refresh()
SYSWAIT1(0.01)
NEXT
nLl := 660
G -= 8
NEXT
ENDIF
RETURN NIL
Application
===========
Path and name: G:\13_02_2016\BlackJack\BlackJack.Exe (32 bits)
Size: 7,474,688 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603)
FiveWin Version: FWHX 16.01
Windows version: 6.1, Build 7600
Time from start: 0 hours 0 mins 24 secs
Error occurred at: 02/20/16, 00:43:25
Error description: Error BASE/1004 Class: 'NIL' has no exported method: NWIDTH
Args:
[ 1] = U
Stack Calls
===========
Called from: => NWIDTH( 0 )
Called from: .\source\classes\BITMAP.PRG => TBITMAP:NEW( 178 )
Called from: .\source\classes\IMAGE.PRG => TIMAGE:NEW( 53 )
Called from: Source\PBlack.prg => CARDMOVE( 959 )
Called from: Source\PBlack.prg => PLAY21( 290 )
Called from: Source\PBlack.prg => (b)BUILDMENU( 118 )
Called from: .\source\classes\MENU.PRG => TMENU:COMMAND( 1062 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 380 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 905 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 293 )
Called from: Source\PBlack.prg => BLACKJACK( 101 )
static oDlg21
static c_path1
static oSprite[52]
static nCard
static adeck
static ncardval := 1
static ccardname := 2
static ccardBmp := 3
static ndecksize := 52
static ndelay := 2
static anewdeck
Function Play21()
local nmaxchips := 1000
local nchips
local nbet := 0
local ncardsleft := 0
local ndealerdealt := 0
local nplayerdealt := 0
local ndeckpos := 1
local caction := " "
local aplayershand
local adealershand
local ldoubledown := .f.
local lplayerbust := .f., ldealerbust := .f.
local nplayerhandval
local ndealerhandval
local cplayagain := "Y"
local ndealrow := 95
local nplayrow := 450
local ndealcol := 660
local nplaycol := 660
nchips := nmaxchips
nCard:= 1
do while .t.
aplayershand := {}
adealershand := {}
if ncardsleft < 10 // if there are < 10 cards on deck it make a shuffle
msginfo("Please wait while I shuffle the deck...","BlackJack")
newdeck() // create an array with 4 field for the cards
shuffle() // shuffle the card array with random function
ncardsleft := ndecksize
ndeckpos := 1
endif
// show the chips
Msginfo( "You have "+alltrim(str(nchips))+" chips.","BlackJack")
nbet := 1
MsgGet( TXT_GAME, TXT_HOW_BAT_CHIPS, @nBet, , , )
msginfo("your Bet is :"+STR(nBet))
ndealerdealt := 10
nplayerdealt := 10
// delear Cards
CardMove(0, ndealrow, nplayrow, ndealcol+ndealerdealt*4, nCard, .T.) // animation card delear Back ( hide)
aadd(adealershand,{adeck[ndeckpos,ncardval],adeck[ndeckpos,ccardname],adeck[ndeckpos,ccardBmp]}) // save to array this card
ndeckpos ++ // deck position
ndealerdealt+=20
nCard++ // oSprite array
CardMove(adeck[ndeckpos,ccardBmp], ndealrow, nplayrow, ndealcol+ndealerdealt*4, nCard, .T.) // animation card delear
aadd(adealershand,{adeck[ndeckpos,ncardval],adeck[ndeckpos,ccardname],adeck[ndeckpos,ccardBmp]}) // save to array this card
ndeckpos ++ // deck position
ndealerdealt +=20
nCard++ // oSprite array
// Player cards
CardMove(adeck[ndeckpos,ccardBmp],ndealrow, nplayrow, nplaycol+nplayerdealt*4, nCard, .F.) // animation first card player
aadd(aplayershand,{adeck[ndeckpos,ncardval],adeck[ndeckpos,ccardname],adeck[ndeckpos,ccardBmp]}) // save to array this card
ndeckpos ++
nplayerdealt+=20
nCard++
CardMove(adeck[ndeckpos,ccardBmp],ndealrow, nplayrow, nplaycol+nplayerdealt*4, nCard, .F.) // animation Second card player
aadd(aplayershand,{adeck[ndeckpos,ncardval],adeck[ndeckpos,ccardname],adeck[ndeckpos,ccardBmp]}) // save to array this card
ndeckpos ++
nplayerdealt+=20
nCard++
ldoubledown := .t.
lplayerbust := .f.
ldealerbust := .f.
lonecard := .f.
do while .t. // the players hand
.....
do while .t // delear Hand
// cicle for the delear hand
....
enddo
do case
// case of total point cards
....
endcase
msginfo( "Dealers hand "+ alltrim(str(ndealerhandval))+CRLF+;
"Players hand " + alltrim(str(nplayerhandval)),TXT_GAME )
ncardsleft := ndecksize - ndeckpos
IF msgYesNo("Play again? ")
clrscr()
else
clrscr()
exit
endif
enddo
return nil
//-------------------------------------------------------------------------------------------------------------------//
FUNCTION CardMove(cCardName, nTDI, nTPI, nLl, nCard, lDealer)
local cardmap
Local G := 46, H := 41, I := 1, J := 1
IF ccardname = 0
cardmap := c_path1 + "Back.bmp"
ELSE
cardmap := c_path1 + "card" +alltrim(str(ccardname)) + ".bmp"
Endif
@ 0,0 IMAGE oSprite[nCard] FILENAME CardMap NOBORDER of oDlg21
oSprite[nCard]:lTransparent := .T.
oSprite[nCard]:Hide()
IF lDealer = .T.
FOR I := 1 TO 1
FOR J := 1 to G
nLl-= 10
oSprite[nCard]:Show()
oSprite[nCard]:Move ( nTDI,nLl,,,.t.)
oSprite[nCard]:Refresh()
SYSWAIT1(0.01)
NEXT
nLl := 660
G -= 8
NEXT
ELSE
nLl := 660
FOR I := 1 TO 1
FOR J := 1 to H
nLl-= 10
oSprite[nCard]:Show()
oSprite[nCard]:Move ( nTDI+= 8,nLl,,,.t.)
oSprite[nCard]:Refresh()
SYSWAIT1(0.01)
NEXT
nLl := 660
G -= 8
NEXT
ENDIF
RETURN NIL
FUNCTION SYSWAIT1( nLong )
local nSeconds
DEFAULT nLong := .1
nSeconds := Seconds() + nLong
WHILE Seconds() < nSeconds
SysRefresh()
END
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 50 guests