I fixed some stuff
I have 2 problems
1) when Mario jumps on the bully his Xspeed gets set to zero
2) knockback seems to be really buggy and random
3) Bully Seems to be walking at a speed of 0.1
4) knockback last forever instead of letting the bully recover
basically I want mario to overcome the enemy if he runs into the back of it or jumps on it
this will make the npc take more knockback then mario
else if the enemy overcomes mario
I want the player to take more knockback
things I haven't implemented yet
1) hit box size calculations for small mario and big mario
2) making it work with any character
- Spoiler
Code: Select all
with NPC(sysval(param1))
''''''''''Execute only if Npc is not Friendly
'if .friendly = 0 Then
'''''''''''''''''''''Collision'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
if char(1).Y+12 > .Y-12 and char(1).Y-12 < .Y+12 and char(1).X+12 > .X-12 and char(1).X-12 < .X+12 Then
''''''''''''''''''''''''''''''''Player Ran Into Back of NPC''''''''''''''''''''''''''''''
if char(1).facing = .facing Then
.ivala = 1 'Collision
.ivalb = 3 'Player Knockback Strength
.ivalc = 5 'Npc Knockback Strength
else
.ivala = 1 'Collision
.ivalb = 5 'Player Knockback Strength
.ivalc = 3 'Npc Knockback Strength
end if
''''''''''''''No Collision'''''''''''''''''''''''''''''''''''''''''''
Else
.ivala = 0 'No Collisions
End if
''''''''''''''''''''''Npc Knockback Player'''''''''''''''''''''''''''''''''''''''''''''''''''''''
'If Collision is True Then Knockback Player
if .ivala = 1 Then
'Set Player Xspeed to the opposite direction of the Npc
Char(1).Xsp = sgn(Char(1).X - .X) * .ivalc
End if
''''''''''''''''''''''Player Knockback Npc''''''''''''''''''''''''''''''''''''''''''''''''
'Set Xspeed to the opposite direction of the player
.Xsp = -sgn(Char(1).X - .X) * .ivalb
'Clamp Knockback to a minium of 0
if .ivalb < 0 Then
.ivalb = 0
'Subtract XSpeed Variable
Else
.ivalb = .ivalb - 0.1
End if
'End if
End With
