Adding BallShadow routine

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #53608
    ninuzzu
    Participant
      @ninuzzu
      vipMember

      Hello guys I would like to tell you how to add ballshadow in a VPX table.

      First you need the ballshadow primitive(s), their texture and material; you can take everything from this test table:

      Ballshadow Test Table

      Now it comes the scripting, you can copy paste this in your tables:

      [code]

      ‘*********** BALL SHADOW *********************************
      Dim BallShadow

      BallShadow = Array (BallShadow1)

      Sub BallShadowUpdate_timer()
      Dim BOT, b
      BOT = GetBalls
      ‘ hide shadow of deleted balls
      If UBound(BOT)<(tnob-1) Then
      For b = (UBound(BOT) + 1) to (tnob-1)
      BallShadow(b).visible = 0
      Next
      End If
      ‘ exit the Sub if no balls on the table
      If UBound(BOT) = -1 Then Exit Sub
      ‘ render the shadow for each ball
      For b = 0 to UBound(BOT)
      If BOT(b).X < Table1.Width/2 Then
      BallShadow(b).X = ((BOT(b).X) – (Ballsize/6) + ((BOT(b).X – (Table1.Width/2))/7)) + 10
      Else
      BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X – (Table1.Width/2))/7)) – 10
      End If
      ballShadow(b).Y = BOT(b).Y + 20
      If BOT(b).Z > 20 Then
      BallShadow(b).visible = 1
      Else
      BallShadow(b).visible = 0
      End If
      Next
      End Sub

      [/code]

       

      Now I will explain that code, which is based on JP’s rolling sound routine.

      You need as much ballshadows primitives as the tnob, defined in the Jp’s rolling sound routine. So, for example

      Const tnob=3

      This means that we have maximum 3 balls during the gameplay, so you need 3 ballshadow primitives (one for each ball). The first part will become

      Dim BallShadow

      BallShadow = Array(Ballshadow1,Ballshadow2,Ballshadow3)

      So you have to duplicate the primitive “Ballshadow1”, included in the sample table above, as many times as the total number of balls (tnob).

      Finally, to make it work, you need to:

      -add a timer, always enabled and with a low interval (I set it at 10 ms): name it BallshadowUpdate

      -change the instances of Table1 with the name of the Table you find in the Vp Editor (default name is table1, but it may change).

      -define the ballsize (default value is 50) or replace the ballsize instances with the value 50 or so.

       

      Note: some authors are using an older version of this code, so please update it with the new one. It fixes some situations when the ball gets destroyed (e.g. it drains) but the shadow is still visible above the pf.

      This is the standard method, it works for 90% of the tables, but there are some cases where you need to hide the shadow because a fakeball is used and you don’t want to display its shadow (or mute the rolling sound).

      Cheers

      3 users thanked author for this post.
      #53615
      Dark
      Moderator
        @dark
        vipMemberContributor

        You should add this as a ‘tutorial’  and/or part of the wiki otherwise it will get buried in the forums.

        3dcreation

        #53633
        Thalamus
        Moderator
          @thalamus
          ContributorMemberModerator

          I was about to say the same Dark – this is exactly the stuff that we need ot keep in a tutorial or wiki section instead of forum !

          Thank you Ninuzzu.

          #53644
          randr
          Keymaster
            @randr
            ModeratorMember

            Totally agree. I will say I love the test tables! So easy to use the code. As they make it very clear what to look for

            ********************************************************
            Messing with the VPinball app and push notifications.
            So if you haven't downloaded app yet what are you waiting for!?
            for IOS and Android

            ********************************************************

            #53670
            ninuzzu
            Participant
              @ninuzzu
              vipMember

              Ok, randr, could you please add it to the wiki? thanks.

              #53674
              Thalamus
              Moderator
                @thalamus
                ContributorMemberModerator

                @randr I’ve put this info up in the wiki, but, what feel we need is some sub levels right under top level ‘Knowlege base’. Editing, Installation, Tweaks – I’m sure we could use a few more. That way I don’t piss off Dark to much ;) ( nah – he is right, need some structure )

                #53675
                randr
                Keymaster
                  @randr
                  ModeratorMember

                  I will work on that this week. That is why I improved the search engine to Ajax. Type something in search on right side bar but don’t press enter. I think WordPress is going to have front end editing “built in” very soon so this could become much better… currently it’s kinda a hack job. Nice part is all wiki publications are “posts” so I can always move them to a cleaner layout

                  ********************************************************
                  Messing with the VPinball app and push notifications.
                  So if you haven't downloaded app yet what are you waiting for!?
                  for IOS and Android

                  ********************************************************

                  #53834
                  bord
                  Moderator
                    @bord
                    MembervipContributorModerator

                    Hey @ninuzzu, how can I hide the shadow while on a ramp? I have a ramp with very little transparency and I’d like to keep the ball shadow from appearing on the playfield below.
                    Thanks!

                    #53837
                    randr
                    Keymaster
                      @randr
                      ModeratorMember

                      I would think tie it to the same code as rolling sound with height?

                      ********************************************************
                      Messing with the VPinball app and push notifications.
                      So if you haven't downloaded app yet what are you waiting for!?
                      for IOS and Android

                      ********************************************************

                      #53838
                      jbg4208
                      Participant
                        @jbg4208
                        Member

                        That was easy. Thanks Ninuzzu!! New 2.0 of Kiss coming soon with this change and others.

                        #53892
                        ninuzzu
                        Participant
                          @ninuzzu
                          vipMember

                          @bord: well, there are two ways of doing it: one is using the ball height so you need to change this:

                          If BOT(b).Z > 20 Then
                          BallShadow(b).visible = 1
                          Else
                          BallShadow(b).visible = 0
                          End If

                          Into this, for example

                          If BOT(b).Z > 20  AND BOT(b).Z < 50 Then
                          BallShadow(b).visible = 1
                          Else
                          BallShadow(b).visible = 0
                          End If

                          This says to render the shadow only when ball height is something between 20 and 50 (remember that the ball height =  ballsize/2)

                          There’s another way, more complex, by placing a trigger on ramp enter and another one on ramp exit, then use an array:

                          ReDim OnRamp(tnob-1)

                          For i = 0 to (tnob-1): OnRamp(i)=0:next

                           

                          ……………

                          If BOT(b).Z > 20 AND OnRamp(b)= 0 Then
                          BallShadow(b).visible = 1
                          Else
                          BallShadow(b).visible = 0
                          End If

                           

                           

                        Viewing 11 posts - 1 through 11 (of 11 total)

                        Forums are currently locked.

                        ©2024 VPinBall.com

                        Log in with your credentials

                        Forgot your details?