Flashing (blinking) Walls
lpetrowicz
Member Posts: 12
I am trying to create a game that will have flashing walls. I want to make the walls flash (blink) at different rates. I also want them to be able to be collided with when visible and fly by when they are not there. Does anyone have any idea how to make this happen? I have searched the net up and down. Thanks.
Comments
To answer your question, you would change self.color.alpha which is a value between 0 and 1 that represents 0% to 100% opacity. At 0 (0%), self.color.alpha renders an actor invisible.
You can use the Timer or Interpolate behaviors to change the value of attributes including self.color.alpha.
You would then use a rule that says:
When attribute self.color.alpha > 0
When actor collides with actor [moving actor]
[whatever you want to happen when the actor hits a visible wall]
*You may find that > 0 is not the best condition here because a wall at 0.1 (10%) opacity can also appear to be invisible or too faint to notice. So try it out with different values in the rule condition.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
(click anywhere on the screen to spawn a ball)
Link: https://www.mediafire.com/?vqzjr9p9b9ypd0i
Changing the opacity of an actor does not affect its collision properties in any way. But you can use that changed value as a condition for a rules that checks for collision. That's what the demo does and what my rule above does.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If you can't open it, you can re-create the rules. The hero actor I made just moves with keyboard controls (left and right) and the wall has these rules:
(all of the attributes are self.color.alpha... you'd also need to change the physics settings on both actors so that they have fixed rotation and no bounciness)
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User