How do I sort lights out on a pinball

0 favourites
  • 3 posts
From the Asset Store
amazing template of the game of ordering colors with strings made with construct3 (requires c3 license) optimized with j
  • Im making a pinball that is coming along pretty well, all the graphics done as good as I want them to be atm.

    Ive got the flippers working but need to work on physics.....need to slow the ball down a bit

    My immediate question is to do with lights,

    The light set up is : 2 frame animation , frame 1 = off frame 2 = on
    Ball collision on trigger changes frame of animation [/code:w6obohht]
    As can be seen in the pic: I have 5 lanes at the top of the table, these are triggered by the dark lines you see in the lanes (just like a real one) Is there a way to simplify the process using families or such ? or do I need an event for each trigger and light so they work independently. 
    
    ATM all the lights and triggers are just drag and dropped from the project panel. But as far as I can see I need to clone and code each one is that right ? I hope not... as can be seen in the table SS, I got a few lights to code  and my next table will have more lol
    
    Cheers for any help
    thren
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I guess you could choose to work either with containers and add the trigger as well as the light to it to simplify the code.

    Also using families could help.

    And be sure to use the function object, so you only have to write the code once.

  • Add an instance variable to both the light and the switch called "id". Set each "id" of a pair of light and switch the the same value (first light and switch id 1, second light and switch id 2, etc)

    Now on the events,

    Ball collides with switch
    Light.id = Switch.id (don't use the system event "compare two values", use the Light event "compare instance variable)
        : Set Light animation
    [/code:3mvp28wc]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)