0
There is an animation in the game that of the attacking character with the sword,
ah sword and an image behind the character, the code draws like this.
but my real problem is with Index, when the player goes through a kind of portal to go to another map, the i
ends up being Nill
#--------------------------------------------------------------------------
# * Atualização do ataque
#--------------------------------------------------------------------------
def update_attack
for i in 1..$game_temp.Player_HighIndex
if $game_system.PlayerAttacking(i)
if @createdanim[i] == 0
create_anim(i)
end
if @createdanim[i].nil?
create_anim(i)
end
end
end
if @anim.nil? || @count.nil? || @icon_index.nil? || @createdanim.nil?
@anim = []
@count = []
@icon_index = []
@createdanim = []
end
for i in 1..$game_temp.Player_HighIndex
if @count[i] && @count[i] >= 0
@anim[i].x = 1
@anim[i].x = (StructManager.Player(i).X + 1 ) * 32 + Position[StructManager.Player(i).Dir][0] - 16
@anim[i].y = (StructManager.Player(i).Y + 1 ) * 32 + Position[StructManager.Player(i).Dir][1] - 5
case @count[i]
when 12; set_angle(i, 0)
when 9; set_angle(i, 1)
when 6; set_angle(i, 2)
when 3; set_angle(i, 3)
when 0
@anim[i].bitmap = nil
@count[i] = nil
@anim[i].visible = false
@anim[i].dispose
@anim[i] = nil
$game_system.SetPlayerAttacking(i, false)
@createdanim[i] = 0
end
@count[i] -= 1 if @count[i]
end
end
@createdanim[i] == 0
return;
end
Exp
In the case
if @createdanim[i] == 0
ends up being if @createdanim[Nill] == 0
if the player presses the Z of but when passing through the portal.
but in the event it would have to be the i
of the player(for i in 1..$game_temp.Player_HighIndex
).
I want to know how do I make the animation not happen if the i
for Null
or even he repeated the animation if it is Null
Any hints because I already try to use one return if @createdanim[i] == Nill
or false
but maybe I did it the right way.
Possible solution.
I think you already understand the source of the problem, the i
player only updates once, in case I press the Z button for the second time the i
= 0.
That’s where the
if @createdanim[i] == 0
create_anim(i)
end
when the player changes the map def update_attack
updates and the i
is no longer zero, so you’re rolling a bug since this two action is done at the same time.
then in case I have to do the def update_attack
be called every time the person presses Z, for ta always updating the i
of the player.
Honestly I could not understand any of this doubt. Which language? Click on EDIT and explain the problem better.
– user28595
RGSS3 I think it’s called Ruby.
– Lks Florêncio
But your doubt is still very confusing. I suggest you click EDIT and be clearer on it. See [Ask] how can you make her better.
– user28595
Look this here to facilitate why I can’t explain better I hope it helps. I want to know how do I make the animation not happen if i’m Null or even it repeated the animation if it’s Null
– Lks Florêncio