| Mirage Source http://miragesource.net/forums/ |
|
| Using Click for Actions http://miragesource.net/forums/viewtopic.php?f=210&t=44 |
Page 1 of 1 |
| Author: | Tutorial Bot [ Thu Jun 01, 2006 9:10 pm ] |
| Post subject: | Using Click for Actions |
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. 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. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|