Help with My Bully Script? (Update)

Description: Internal scripting system of SMBX-38A Engine based on the simple VB-like language
Moderators: Lx Xzit, Yoshi021, 5438A38A, Semi-moderatos, Moderators

Shadowblitz16
Topic author, Close friend
Close friend
Shadowblitz16
Topic author, Close friend
Close friend
Reputation: 12
Posts: 93
Joined: 15 Aug 2016

Post #1by Shadowblitz16 » 10 Oct 2016, 4:30

Can someone help me with my knockback code?

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

Shadowblitz16
Topic author, Close friend
Close friend
Shadowblitz16
Topic author, Close friend
Close friend
Reputation: 12
Posts: 93
Joined: 15 Aug 2016

Post #2by Shadowblitz16 » 11 Oct 2016, 7:56

Bump is anybody there?
I'm trying to fix my code up but I don't know how I have rewriten the script several times after this one
but its seems I can't easily knockback the npc since the Xspeed for the npc is the actual value of how fast it moves instead of just of like players where you can use it to add force.

please I see that people are seeing my topic however there seems no motivation to help me. I'm starting to wonder why 38A didn't use lunalua or some sort of language that is easier to use and more developed


Return to “TeaScript”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest