|

楼主 |
发表于 2004-7-25 20:37:00
|
显示全部楼层
Re:Alpha2D Demo11
Option Explicit
Private WithEvents m_VBGameEngine As CGameEngine
Private m_x As Integer
Private m_y As Integer
Private m_BS As CSurface
Private m_LS As CSurface
Private m_Custor As CSurface
Private Sub Form_Unload(Cancel As Integer)
'注意销毁的代码
Cancel = 1
m_VBGameEngine.ExitGame = True
End Sub
Private Sub Form_Load()
Me.Show
Set m_VBGameEngine = New CGameEngine
With m_VBGameEngine
.SetMode 1
.MouseVisiable = False
.SetRefreshSpeed 85
.SetScreen 640, _
480, _
hWnd, False
End With
'Clear All Resoures
End
End Sub
Private Sub m_VBGameEngine_GameExit()
'游戏的资源释放销毁
Set m_BS = Nothing
Set m_LS = Nothing
Set m_Custor = Nothing
Set m_VBGameEngine = Nothing
End Sub
Private Sub m_VBGameEngine_GameInit(GameInit As Boolean)
'引擎初始化代码
m_x = 115
m_y = 100
Set m_BS = New CSurface
m_BS.LoadJPG App.Path + "\朝美学生服.bmp"
Set m_LS = New CSurface
m_LS.LoadJPG App.Path + "\2.bmp"
Set m_Custor = New CSurface
m_Custor.LoadJPG App.Path + "\cursor.bmp"
g_Screen.CreateLightTable
'g_Screen.EnableZBuffer
End Sub
Private Sub m_VBGameEngine_GameRefresh()
'刷新屏幕
g_MainSurface.Clear
'g_Screen.ClearZBuffer
'g_Screen.BltWithZBuffer m_BS, 100, 0, 100, 0
'g_Screen.BltWithZBuffer m_BS, 200, 0, 1000, 0
If m_BS.IsTrans(m_x, m_y) Then
g_MainSurface.FastBltEx m_BS, 0, 0
Else
g_MainSurface.BltWithEdgeline m_BS, 0, 0, &H1F
g_MainSurface.TextOut 0, 40, "发现当前目标:—)", vbGreen
End If
g_Screen.SetAmbientLight 50 + 50 * Sin(Timer)
g_Screen.BltToLightTable m_LS, -64, -64
g_Screen.BltToLightTable m_LS, 32, 0
g_Screen.BltToLightTable m_LS, m_x - 64, m_y - 64
'g_Screen.BltToLightTable m_LS, m_x - 64 - 64, m_y - 64 - 64
'g_Screen.BltToLightTable m_LS, m_x - 64, m_y
'g_Screen.BltToLightTable m_LS, m_x, m_y - 64
g_MainSurface.TextOut 0, 15, " ress ESC To Exit!", vbGreen
g_MainSurface.FastBltEx m_Custor, m_x, m_y
If g_Inputs.KeyDown(17) Then m_y = m_y - 1
If g_Inputs.KeyDown(31) Then m_y = m_y + 1
If g_Inputs.KeyDown(30) Then m_x = m_x - 1
If g_Inputs.KeyDown(32) Then m_x = m_x + 1
If g_Inputs.KeyDown(1) Then m_VBGameEngine.ExitGame = True
End Sub
Private Sub m_VBGameEngine_InputMsg(MsgType As DefMsgType, ByVal Value As Long, ByVal x As Long, ByVal y As Long)
If MsgType = MSG_MouseMove Then
m_x = x
m_y = y
End If
End Sub
|
|