Isto é uma pré-visualização de um tema em Hitskin.com
Instalar o tema • Voltar para a ficha do tema
Urgente Projectiles
3 participantes
Página 1 de 1
Urgente Projectiles
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
marccvz- Novato
- Mensagens : 29
Créditos : 1
Re: Urgente Projectiles
Provavelmente o DDSD_Projectile(PicNum) ou o DDS_Projectile(PicNum) tem funções ou propriedades que retornam o tamanho (width e height) do sprite.
Pegue o height, divida por 4 e substitua por todos os PIC_Y na função, faça o mesmo com o width mas substitua os PIC_X ao invés de PIC_Y.
Pegue o height, divida por 4 e substitua por todos os PIC_Y na função, faça o mesmo com o width mas substitua os PIC_X ao invés de PIC_Y.
_________________
http://4tabern.com
Terabin- Iniciante
- Mensagens : 66
Créditos : 39
Re: Urgente Projectiles
' 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
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
Cenourinha404- Semi-Experiente
- Mensagens : 82
Créditos : 2
Ficha do personagem
Nível: 1
Experiência:
(0/0)
Vida:
(30/30)
Re: Urgente Projectiles
Esse codigo permite sprite maior de 32x32
Cenourinha404- Semi-Experiente
- Mensagens : 82
Créditos : 2
Ficha do personagem
Nível: 1
Experiência:
(0/0)
Vida:
(30/30)
Tópicos semelhantes
» Projectiles
» [Duvida]Projectiles
» Alguem tem projectiles
» GetPlayerDef Projectiles
» Duvidas Urgente'
» [Duvida]Projectiles
» Alguem tem projectiles
» GetPlayerDef Projectiles
» Duvidas Urgente'
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos