How to make Concept Like Color Switch?

0 favourites
  • 4 posts
From the Asset Store
Toggles Dials Switches and Alerts ! A foundational sound grouping of Analog type switches and Steampunk effects
  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • Is there any way to get HEX coding system rather than rgb or any other...

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)