How do I sort lights out on a pinball

Get help using Construct 2

Post » Wed Mar 26, 2014 6:23 am

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,
Code: Select all
The light set up is : 2 frame animation , frame 1 = off frame 2 = on
Ball collision on trigger changes frame of animation

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
You do not have the required permissions to view the files attached to this post.
B
13
S
3
G
1
Posts: 25
Reputation: 1,176

Post » Wed Mar 26, 2014 8:12 am

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Mar 26, 2014 6:20 pm

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,

Code: Select all
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
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249


Return to How do I....?

Who is online

Users browsing this forum: dop2000, MikaelS, nahima, Nicolas951, Shenkai the ssj and 22 guests