Results 1 to 9 of 9

Thread: Little prob with my game (help needed)

Threaded View

  1. #1

    Thread Starter
    Junior Member TheKGBspy's Avatar
    Join Date
    Nov 2001
    Posts
    21

    Talking Little prob with my game (help needed)

    ok i have a little prob. i want to know how to use bitblt for my game.

    my game is a rts, a commandos style game, that u must infiltrate ennemy base with elite soldier. i want to use bitblt to load my picture for the color mask (i dont kknow how to use it and incorpor it into my game), work in frame per second, because now im using a timer (yep one timer for 6 soldier ), and finnaly i want to know how to delete a frame in the memory because my soldier have 6 frame per animation ( ex the firering animation while the soldier stand up have 6 frame per derection (8 direction)
    so in all it have 6 * 8 frame for firering) and putting all that in one bmp will be long but its is better?

    i have also my map editor for my game and i want to know how to unload picture from the memory when i dont looking a tile.


    there is my map editor coding:


    VB Code:
    1. Private Sub BoNextTile_Click()
    2. If TileView = NbOfTile Then TileView = 0
    3. TileView = TileView + 1
    4. TileSelectionSub
    5. End Sub
    6.  
    7. Private Sub BoPrevTile_Click()
    8. If TileView = 1 Then TileView = (NbOfTile + 1)
    9. TileView = TileView - 1
    10. TileSelectionSub
    11. End Sub
    12.  
    13. Private Sub TileSelectionSub()
    14. SelectionTile.Picture = LoadPicture(App.Path & "/tiles/" & TypeOfTerrain & "/" & TileView & ".bmp")
    15. LaTileInfo.Caption = "Type :" & TypeOfTerrain & " Tile #: " & TileView
    16. SelectionTile.Left = (PicSelectTile.Width - SelectionTile.Width) / 2
    17. SelectionTile.Top = (PicSelectTile.Height - SelectionTile.Height) / 2
    18. SelectiontileCase.Width = SelectionTile.Width
    19. SelectiontileCase.Height = SelectionTile.Height
    20. SelectiontileCase.Top = SelectionTile.Top
    21. SelectiontileCase.Left = SelectionTile.Left
    22.  
    23. End Sub
    24.  
    25. Private Sub Form_Activate()
    26.  
    27. If LoadingNew = True Then
    28. Largeur = Int(Map.Width / ImMapTile(0).Width)
    29. Hauteur = Int(Map.Height / ImMapTile(0).Height)
    30. RadarTile(0).Width = Int((ImMapTile(0).Width / Map.Width) * Radar.Width)
    31. RadarTile(0).Height = Int((ImMapTile(0).Height / Map.Height) * Radar.Height)
    32.  
    33. LoadingTest = Largeur * Hauteur
    34.  
    35. NbTile = 0
    36. For l = 0 To Largeur
    37.   For h = 0 To Hauteur
    38.      Randomize
    39.      GrassTile = Int((16 * Rnd) + 1)
    40.      NbTile = NbTile + 1
    41.      Load ImMapTile(NbTile)
    42.      Load RadarTile(NbTile)
    43.      RadarTile(NbTile).Visible = True
    44.      RadarTile(NbTile).Left = RadarTile(0).Width * l
    45.      RadarTile(NbTile).Top = RadarTile(0).Height * h
    46.      RadarTile(NbTile).BackColor = &H8000&
    47.      RadarTile(NbTile).BorderColor = RadarTile(NbTile).BackColor
    48.      'ImMapTile(NbTile).Picture = LoadPicture(App.Path & "/tiles/grass/" & GrassTile & ".bmp")
    49.      ImMapTile(NbTile).Visible = True
    50.      ImMapTile(NbTile).Left = ImMapTile(0).Width * l
    51.      ImMapTile(NbTile).Top = ImMapTile(0).Height * h
    52.      ImMapTile(NbTile).ZOrder 1
    53.      If loadingbar.Value > 99 Then GoTo Suite
    54.      loadingbar.Value = (NbTile / LoadingTest) * 100
    55. Suite:
    56.      Debug.Print NbTile
    57.   Next h
    58. Next l
    59. Radar.Visible = True
    60. Map.Visible = True
    61. TypeOfTerrain = "Grass"
    62. TileView = 1
    63. NbOfTile = 16
    64. SelectionTile.Picture = LoadPicture(App.Path & "/tiles/" & TypeOfTerrain & "/" & TileView & ".bmp")
    65.  
    66. RectRadar.Height = (MapView.Height * Radar.Height) / Map.Height
    67. RectRadar.Width = (MapView.Width * Radar.Width) / Map.Width
    68.  
    69. LoadingNew = False
    70.  
    71. loadingbar.Value = 0
    72. End If
    73.  
    74. End Sub
    75.  
    76. Private Sub Form_Load()
    77. CellLoad = 0
    78. LoadingNew = False
    79. ImMapTile(0).Picture = LoadPicture(App.Path & "/tiles/" & "grass" & "/" & "1.bmp")
    80. SelectTile.Width = ImMapTile(0).Width
    81. SelectTile.Height = ImMapTile(0).Height
    82. RectRadar.Top = 0
    83. RectRadar.Left = 0
    84.  
    85.  
    86.   For f = 0 To 3
    87.    
    88.  Select Case f
    89.   Case 0
    90.     Frame(0).Top = 1920
    91.   Case 1
    92.     Frame(1).Top = 2170
    93.   Case 2
    94.     Frame(2).Top = 2425
    95.   Case 3
    96.     Frame(3).Top = 2680
    97.   End Select
    98.   Frame(f).Height = 255
    99.  
    100.   Next f
    101.  
    102. End Sub
    103.  
    104. Private Sub Form_Unload(Cancel As Integer)
    105. For u = 1 To NbTile
    106. Unload ImMapTile(u)
    107. Next u
    108. End Sub
    109.  
    110. Private Sub Frame_Click(Index As Integer)
    111.  
    112.  
    113.   If Frame(Index).Height = 1815 Then
    114.   Frame(Index).Height = 255
    115.  
    116.   For f = 0 To 3
    117.   Frame(f).Visible = True
    118.   Next f
    119.  
    120.   Select Case Index
    121.   Case 0
    122.     Frame(0).Top = 1920
    123.   Case 1
    124.     Frame(1).Top = 2170
    125.   Case 2
    126.     Frame(2).Top = 2425
    127.   Case 3
    128.     Frame(3).Top = 2680
    129.   End Select
    130.   PicMenu(Index).Visible = False
    131.   Exit Sub
    132.  
    133.   End If
    134.  
    135.   If Frame(Index).Height = 255 And Frame(Index).Width = 2295 Then
    136.   Frame(Index).Height = 1815
    137.   Frame(Index).Top = 1920
    138.   PicMenu(Index).Visible = True
    139.  
    140.    
    141.   Select Case Index
    142.   Case 0
    143.     MenuSelect = "Terrain"
    144.   Case 1
    145.     MenuSelect = "Units"
    146.   Case 2
    147.     MenuSelect = "Buildings"
    148.   Case 3
    149.     MenuSelect = "Cell"
    150.   End Select
    151.  
    152.     For f = 0 To 3
    153.       Frame(f).Visible = False
    154.     Next f
    155.     Frame(Index).Visible = True
    156.   End If
    157. Debug.Print MenuSelect
    158.  
    159. End Sub
    160.  
    161.  
    162. Private Sub Frame_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    163. Select Case Index
    164.   Case 0
    165.   Frame(1).ForeColor = &H80000012
    166.   Frame(2).ForeColor = &H80000012
    167.   Frame(3).ForeColor = &H80000012
    168.   Frame(0).ForeColor = &H404040
    169.  
    170.   Case 1
    171.   Frame(0).ForeColor = &H80000012
    172.   Frame(2).ForeColor = &H80000012
    173.   Frame(3).ForeColor = &H80000012
    174.   Frame(1).ForeColor = &H404040
    175.  
    176.   Case 2
    177.   Frame(1).ForeColor = &H80000012
    178.   Frame(0).ForeColor = &H80000012
    179.   Frame(3).ForeColor = &H80000012
    180.   Frame(2).ForeColor = &H404040
    181.  
    182.   Case 3
    183.     Frame(1).ForeColor = &H80000012
    184.   Frame(2).ForeColor = &H80000012
    185.   Frame(0).ForeColor = &H80000012
    186.   Frame(3).ForeColor = &H404040
    187.  
    188.  
    189. End Select
    190.  
    191.  
    192. End Sub
    193.  
    194. Private Sub ImMapTile_Click(Index As Integer)
    195. If MenuSelect = "Terrain" Then
    196. ImMapTile(Index).Picture = ImSelectedTile.Picture
    197. If LaSelectedTileType.Caption = "Grass" Then
    198.   RadarTile(Index).BackColor = &H8000&
    199.   RadarTile(Index).BorderColor = &H8000&
    200. ElseIf LaSelectedTileType.Caption = "Water" Then
    201.   RadarTile(Index).BackColor = &HC0C000
    202.   RadarTile(Index).BorderColor = &HC0C000
    203.   End If
    204. End If
    205.  
    206. If MenuSelect = "Cell" Then
    207. If CellWay(1).Value = True Then
    208.   CellLoad = CellLoad + 1
    209.   Load ImMapCelltag(CellLoad)
    210.   ImMapCelltag(CellLoad).Visible = True
    211.   ImMapCelltag(CellLoad).Top = ImMapTile(Index).Top
    212.   ImMapCelltag(CellLoad).Left = ImMapTile(Index).Left
    213.   ImMapCelltag(CellLoad).ZOrder 0
    214.   ImMapCelltag(CellLoad).Enabled = False
    215. End If
    216. If CellWay(0).Value = True Then
    217.   WayLoad = WayLoad + 1
    218.   Load ImMapWaypoint(WayLoad)
    219.   ImMapWaypoint(WayLoad).Visible = True
    220.   ImMapWaypoint(WayLoad).Top = ImMapTile(Index).Top
    221.   ImMapWaypoint(WayLoad).Left = ImMapTile(Index).Left
    222.   ImMapWaypoint(WayLoad).ZOrder 0
    223.   ImMapWaypoint(WayLoad).Enabled = False
    224. End If
    225. End If
    226.  
    227.  
    228. End Sub
    229.  
    230. Private Sub ImMapTile_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    231. SelectTile.Top = ImMapTile(Index).Top
    232. SelectTile.Left = ImMapTile(Index).Left
    233. End Sub
    234.  
    235. Private Sub MeFiExit_Click()
    236. End
    237. End Sub
    238.  
    239. Private Sub MeFiNew_Click()
    240. Load FoNew
    241. FoNew.Visible = True
    242. End Sub
    243.  
    244. Private Sub Option1_Click(Index As Integer)
    245. Debug.Print Index
    246. Select Case Index
    247.   Case 0
    248.     TypeOfTerrain = "Grass"
    249.     NbOfTile = 16
    250.   Case 1
    251.   Case 2
    252.     TypeOfTerrain = "Rock"
    253.     NbOfTile = 1
    254.   Case 3
    255.   Case 4
    256.   Case 5
    257.     TypeOfTerrain = "Water"
    258.     NbOfTile = 1
    259. End Select
    260. TileView = 1
    261. LaTileInfo.Caption = "Type :" & TypeOfTerrain & " Tile #: " & TileView
    262. SelectionTile.Picture = LoadPicture(App.Path & "/tiles/" & TypeOfTerrain & "/" & TileView & ".bmp")
    263. SelectionTile.Left = (PicSelectTile.Width - SelectionTile.Width) / 2
    264. SelectionTile.Top = (PicSelectTile.Height - SelectionTile.Height) / 2
    265. SelectiontileCase.Width = SelectionTile.Width
    266. SelectiontileCase.Height = SelectionTile.Height
    267. SelectiontileCase.Top = SelectionTile.Top
    268. SelectiontileCase.Left = SelectionTile.Left
    269. End Sub
    270.  
    271. Private Sub Radar_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    272. On Error Resume Next
    273.  
    274. Select Case Button
    275.  
    276.   Case 1
    277.     RectRadar.Top = Y - (RectRadar.Height / 2)
    278.     RectRadar.Left = X - (RectRadar.Width / 2)
    279.    
    280.     If (RectRadar.Left + RectRadar.Width) > Radar.Width Then
    281.     RectRadar.Left = Radar.Width - RectRadar.Width
    282.     End If
    283.  
    284.     If RectRadar.Left < 0 Then
    285.     RectRadar.Left = 0
    286.     End If
    287.  
    288.     If (RectRadar.Top + RectRadar.Height) > Radar.Height Then
    289.     RectRadar.Top = Radar.Height - RectRadar.Height
    290.     End If
    291.  
    292.     If RectRadar.Top < 0 Then
    293.     RectRadar.Top = 0
    294.     End If
    295.  
    296.     Map.Left = -((RectRadar.Left * Map.Width) / Radar.Width)
    297.     Map.Top = -((RectRadar.Top * Map.Height) / Radar.Height)
    298.  
    299. End Select
    300.  
    301. Map.SetFocus
    302.  
    303. End Sub
    304.  
    305. Private Sub SelectionTile_Click()
    306. LaSelectedTileType.Caption = TypeOfTerrain
    307. LaSelectedTileNb.Caption = TileView
    308. ImSelectedTile.Picture = SelectionTile.Picture
    309. 'LaTileSelect.Caption = "Type :" & TypeOfTerrain & " Tile #: " & TileView
    310. End Sub

    i have a module that contain all my variable

    VB Code:
    1. Public Largeur As Long
    2. Public Hauteur As Long
    3. Public NbTile As Long
    4. Public GrassTile As Integer
    5. Public TypeOfTerrain As String
    6. Public TileView As Integer
    7. Public IsMouse1Down As Boolean
    8. Public NbOfTile As Integer
    9. Public MiniMapTileH As Long
    10. Public MiniMapTileL As Long
    11. Public TileIndex As Long
    12. Public LoadingNew As Boolean
    13. Public LoadingTest As Long
    14. Public AlreadyMapped As Boolean
    15. Public MenuSelect As String
    16. Public Choix As Long
    17. Public CellLoad As Long
    18. Public WayLoad As Long
    Last edited by TheKGBspy; Jan 10th, 2002 at 10:11 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width