How to make Concept Like Color Switch?

Get help using Construct 2

Post » Tue Jan 19, 2016 12:49 am

Hello guys i need to ask how can i make player not to die when enemy and player color is same but when the color change and player touched different color of the enemy then player would die!

For example color switch!

any suggestion!

thanx
B
12
S
3
Posts: 31
Reputation: 825

Post » Tue Jan 19, 2016 3:11 am

There are several ways... the obvious way is to use a variable that contains the color.. ie Color=1 for red, Color=2 for blue, etc. then simply track the state of the color variable to determine if player variable is the same value...

You could also use frames if all the colors are in one static animation strip and you knew the frames location.. ie red= frame 1, blue = frame 2, etc... then check to see what frame is displaying and match it to a player instance variable of similar values...

I would go variables, much easier...

example:
Make an instance variable in the enemy objects called CurrentColor=0.
Decide what numbers you want to correspond to what colors (red=1, yellow=2, blue=3... RGB#3436... whatever).
In the events that set their initial color set their instance variable to their assigned color (Ie. red cube in above example would be CurrentColor=1).
Anytime the enemy changes color simply change the variable value to match the new color number.
Make an instance variable in Player object for PlayerColor=0 and in initial Player set-up set its value to its color using your color to number plan.
Whenever the Player changes color have those events set its instance variable to match the new color.
Whenever the Player and Enemy collide/Overlap then compare the instance variable of the colliding/overlapping enemy to that of the Player.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
60
S
15
G
8
Posts: 620
Reputation: 8,972

Post » Tue Jan 19, 2016 6:04 am

Is there any way to get HEX coding system rather than rgb or any other...
B
12
S
3
Posts: 31
Reputation: 825

Post » Tue Jan 19, 2016 10:02 am

smashupbuddy wrote:Is there any way to get HEX coding system rather than rgb or any other...


You can use SetColor Effect... and you can set the RGB of the sprite...

for example, when a player touch a red color, you can change the 3 variable to make the color red... etc
B
21
S
9
Posts: 298
Reputation: 2,967


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Particle games and 8 guests