Hi everyone!
I was looking at the WalkingCharacter code, and I don't understand how it manages to change the image of the KID when he walks.
Can any of you tell me exactly how to do it? or send me an example?
In short, if a dynamic object wants me to change the sequence of images to the ones I want, I don't know how to do it.
best regards
Dim right As Boolean = bw.mGame.RightDown
Dim left As Boolean = bw.mGame.LeftDown
If right And left Then
right = bw.FlipHorizontal = False
End If
Dim vx As Float
If right Then
vx = 3
bw.FlipHorizontal = False
IncreaseFrame = InAir = False
Else If left Then
vx = -3
IncreaseFrame = InAir = False
bw.FlipHorizontal = True
Else if InAir = False Then
vx = 0
End If
The WalkingCharacter is quite complicated example.
The Mario example changes the graphics with this code (Mario class):
B4X:
If InAir Then
bw.GraphicName = GetGraphicName("jumping")
Else If Abs(bw.Body.LinearVelocity.X) < 0.4 Then
If bw.Body.LinearVelocity.X <> 0 Then bw.Body.LinearVelocity = x2.CreateVec2(0, 0)
bw.GraphicName = GetGraphicName("standing")
Else
bw.GraphicName = GetGraphicName("walking")
End If