Hi Enrico !
Hi Enrico !
How to create games with xHarbour
I used FWH and xHB.
function Games()
local oBmpBackGround, oBmpSprite1, oBmpSprite2
DEFINE WINDOW oWnd
@0,0 bitmap oBmpBackGround FILE "room.bmp" pixel of oWnd
@20,10 bitmap oBmpSprite1 FILE "ball.bmp" pixel of oWnd
oBmpSprite1:lTransparent := .t.
?????????????????????????????
// But Not Transparent //
?????????????????????????????
ACTIVATE WINDOW oWnd
return nil
Thank's
Best Regard
Areang
I used FWH and xHB.
function Games()
local oBmpBackGround, oBmpSprite1, oBmpSprite2
DEFINE WINDOW oWnd
@0,0 bitmap oBmpBackGround FILE "room.bmp" pixel of oWnd
@20,10 bitmap oBmpSprite1 FILE "ball.bmp" pixel of oWnd
oBmpSprite1:lTransparent := .t.
?????????????????????????????
// But Not Transparent //
?????????????????????????????
ACTIVATE WINDOW oWnd
return nil
Thank's
Best Regard
Areang
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Hi Enrico !
This is a working sample:
EMG
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
local oWnd, oBrush, oSprite, oTimer
DEFINE BRUSH oBrush;
FILE "c:\fwharbour\bitmaps\backgrnd\beach.bmp"
DEFINE WINDOW oWnd;
BRUSH oBrush
@ 0, 0 BITMAP oSprite;
FILE "c:\fwharbour\bitmaps\fdem5.bmp";
PIXEL NOBORDER
oSprite:lTransparent = .T.
DEFINE TIMER oTimer OF oWnd;
INTERVAL 10;
ACTION MOVESPRITE( oWnd, oSprite )
ACTIVATE WINDOW oWnd;
ON INIT oTimer:Activate()
RELEASE TIMER oTimer
RETURN NIL
STATIC FUNCTION MOVESPRITE( oWnd, oSprite )
LOCAL aWndRect := GETCLIENTRECT( oWnd:hWnd )
LOCAL nWndWidth := aWndRect[ 4 ] - aWndRect[ 2 ]
LOCAL nWndHeight := aWndRect[ 3 ] - aWndRect[ 1 ]
LOCAL nXPos, nYPos
STATIC nXStep := 5
STATIC nYStep := 5
nXPos = oSprite:nLeft + nXStep
nYPos = oSprite:nTop + nYStep
IF nXPos < 0
nXPos = 0
nXStep = -nXStep
ENDIF
IF nYPos < 0
nYPos = 0
nYStep = -nYStep
ENDIF
IF nXPos + oSprite:nWidth >= nWndWidth
nXPos = nWndWidth - oSprite:nWidth - 1
nXStep = -nXStep
ENDIF
IF nYPos + oSprite:nHeight > nWndHeight
nYPos = nWndHeight - oSprite:nHeight
nYStep = -nYStep
ENDIF
oSprite:Move( nYPos, nXPos, , , .T. )
RETURN NIL
Hi Areang,
Try this:
Regards,
Rossine.
Try this:
Code: Select all
...
IF nYPos + oSprite:nHeight > nWndHeight
nYPos = nWndHeight - oSprite:nHeight
nYStep = -nYStep
ENDIF
oSprite:refresh() &&<<<--- Inside This
oSprite:Move( nYPos, nXPos, , , .T. )
RETURN NIL
Rossine.
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
local oWnd, oBrush, oSprite
DEFINE BRUSH oBrush;
FILE "c:\fwharbour\bitmaps\backgrnd\beach.bmp"
DEFINE WINDOW oWnd;
BRUSH oBrush
oWnd:bKeyDown = { | nKey | MoveSprite( oWnd, oSprite, nKey ) }
@ 0, 0 BITMAP oSprite;
FILE "c:\fwharbour\bitmaps\fdem5.bmp";
PIXEL NOBORDER
oSprite:lTransparent = .T.
ACTIVATE WINDOW oWnd
RETURN NIL
STATIC FUNCTION MOVESPRITE( oWnd, oSprite, nKey )
LOCAL aWndRect := GETCLIENTRECT( oWnd:hWnd )
LOCAL nWndWidth := aWndRect[ 4 ] - aWndRect[ 2 ]
LOCAL nWndHeight := aWndRect[ 3 ] - aWndRect[ 1 ]
LOCAL nXPos, nYPos
LOCAL nXStep := 0
LOCAL nYStep := 0
IF nKey = VK_RIGHT; nXStep = 5; ENDIF
IF nKey = VK_LEFT; nXStep = -5; ENDIF
IF nKey = VK_DOWN; nYStep = 5; ENDIF
IF nKey = VK_UP; nYStep = -5; ENDIF
nXPos = oSprite:nLeft + nXStep
nYPos = oSprite:nTop + nYStep
IF nXPos < 0
nXPos = 0
nXStep = -nXStep
ENDIF
IF nYPos < 0
nYPos = 0
nYStep = -nYStep
ENDIF
IF nXPos + oSprite:nWidth >= nWndWidth
nXPos = nWndWidth - oSprite:nWidth - 1
nXStep = -nXStep
ENDIF
IF nYPos + oSprite:nHeight > nWndHeight
nYPos = nWndHeight - oSprite:nHeight
nYStep = -nYStep
ENDIF
oSprite:Refresh()
oSprite:Move( nYPos, nXPos, , , .T. )
RETURN NIL
Hi Enrico.
For the future the game is the good way for all clipper needed.
Just move the image object, click object, show object, hide object, rotate, scale and more. Play the sound and video file.
Think's the object are : image, sound and video
Can you make the lib for this ?
And I will buy the lib from you.
Thank's
Best Regard
Areang
For the future the game is the good way for all clipper needed.
Just move the image object, click object, show object, hide object, rotate, scale and more. Play the sound and video file.
Think's the object are : image, sound and video
Can you make the lib for this ?
And I will buy the lib from you.
Thank's
Best Regard
Areang