Ola pessoal do aldeia alguem poderia me ajudar com o sistema de projectiles.
ele só usa sprites tamanho 32x32 alguem poderia me ajuda a deixa eu que nem o do sprite que pode colocar qualquer tamanho que ele lê obrigado pessoal.
ele só usa sprites tamanho 32x32 alguem poderia me ajuda a deixa eu que nem o do sprite que pode colocar qualquer tamanho que ele lê obrigado pessoal.
- Código:
' player Projectiles
Public Sub BltProjectile(ByVal Index As Long, ByVal PlayerProjectile As Long)
Dim x As Long, Y As Long, PicNum As Long, i As Long
Dim rec As DxVBLib.RECT
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
' check for subscript error
If Index < 1 Or PlayerProjectile < 1 Or PlayerProjectile > MAX_PLAYER_PROJECTILES Then Exit Sub
' check to see if it's time to move the Projectile
If GetTickCount > Player(Index).ProjecTile(PlayerProjectile).TravelTime Then
With Player(Index).ProjecTile(PlayerProjectile)
' set next travel time and the current position and then set the actual direction based on RMXP arrow tiles.
Select Case .Direction
' down
Case 0
.Y = .Y + 1
' check if they reached maxrange
If .Y = (GetPlayerY(Index) + .Range) + 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
' up
Case 1
.Y = .Y - 1
' check if they reached maxrange
If .Y = (GetPlayerY(Index) - .Range) - 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
' right
Case 2
.x = .x + 1
' check if they reached max range
If .x = (GetPlayerX(Index) + .Range) + 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
' left
Case 3
.x = .x - 1
' check if they reached maxrange
If .x = (GetPlayerX(Index) - .Range) - 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
End Select
.TravelTime = GetTickCount + .Speed
End With
End If
' set the x, y & pic values for future reference
x = Player(Index).ProjecTile(PlayerProjectile).x
Y = Player(Index).ProjecTile(PlayerProjectile).Y
PicNum = Player(Index).ProjecTile(PlayerProjectile).Pic
' check if left map
If x > Map.MaxX Or Y > Map.MaxY Or x < 0 Or Y < 0 Then
ClearProjectile Index, PlayerProjectile
Exit Sub
End If
' check if we hit a block
If Map.Tile(x, Y).Type = TILE_TYPE_BLOCKED Then
ClearProjectile Index, PlayerProjectile
Exit Sub
End If
' check for player hit
For i = 1 To Player_HighIndex
If x = GetPlayerX(i) And Y = GetPlayerY(i) Then
' they're hit, remove it
If Not x = Player(MyIndex).x Or Not Y = GetPlayerY(MyIndex) Then
ClearProjectile Index, PlayerProjectile
Exit Sub
End If
End If
Next
' check for npc hit
For i = 1 To MAX_MAP_NPCS
If x = MapNpc(i).x And Y = MapNpc(i).Y Then
' they're hit, remove it
ClearProjectile Index, PlayerProjectile
Exit Sub
End If
Next
' if projectile is not loaded, load it, female dog.
If DDS_Projectile(PicNum) Is Nothing Then
Call InitDDSurf("projectiles" & PicNum, DDSD_Projectile(PicNum), DDS_Projectile(PicNum))
End If
' get positioning in the texture
With rec
.top = 0
.Bottom = SIZE_Y
.Left = Player(Index).ProjecTile(PlayerProjectile).Direction * SIZE_X
.Right = .Left + SIZE_X
End With
' blt the projectile
Call Engine_BltFast(ConvertMapX(x * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Projectile(PicNum), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
' Error handler
Exit Sub
errorhandler:
HandleError "BltProjectile", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub