01-06-2006, 09:10 PM
Author: ? (unknown)
Difficulty: 2/5
This is an example of how to use clicking for different things. I'll show you a basic mining with click code.
You could change it and make it so if they are next to the rock in any direction it turns them to it and begins to mine or you could use bits of the code for walking.
Difficulty: 2/5
This is an example of how to use clicking for different things. I'll show you a basic mining with click code.
Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim x1 As Long, y1 As Long
x1 = (X / PIC_X)
y1 = (Y / PIC_Y)
If Map.Tile(x1, y1).Type = TILE_TYPE_MINING Then
Dir = GetPlayerDir(MyIndex)
Select Case Dir
Case DIR_UP
If (GetPlayerY(MyIndex) + 1) y1 Then
AddText "You must be next to the rock you are tryign to mine!", BrightRed
Else
Call RockHit(Map.Tile(x1, yl).Data3)
AddText "You hit the rock!", BrightRed
End If
Case DIR_DOWN
If (GetPlayerY(MyIndex) - 1) y1 Then
AddText "You must be next to the rock you are tryign to mine!", BrightRed
Else
Call RockHit(Map.Tile(x1, yl).Data3)
AddText "You hit the rock!", BrightRed
End If
Case DIR_RIGHT
If (GetPlayerX(MyIndex) + 1) x1 Then
AddText "You must be next to the rock you are tryign to mine!", BrightRed
Else
Call RockHit(Map.Tile(x1, yl).Data3)
AddText "You hit the rock!", BrightRed
End If
Case DIR_LEFT
If (GetPlayerX(MyIndex) - 1) x1 Then
AddText "You must be next to the rock you are tryign to mine!", BrightRed
Else
Call RockHit(Map.Tile(x1, yl).Data3)
AddText "You hit the rock!", BrightRed
End If
End Select
End If
End Sub
You could change it and make it so if they are next to the rock in any direction it turns them to it and begins to mine or you could use bits of the code for walking.