Author Topic: Kamilia color change  (Read 1620 times)

Lurpan

  • Wannabe
  • Posts: 18
  • Argentinian player
  • OS:
  • Mac OS X Mac OS X
  • Browser:
  • Safari 6.0 Safari 6.0
    • View Profile
  • Playstyle: Keyboard
Kamilia color change
« on: March 28, 2015, 12:13:38 PM »
Hey !
Ive been watching a lot of k3 final boss now and i would like to create a game with the color change feature. Can anyone post a pic for the kid code and the objects he can pass throygh with this color change?
Im playing fangames shhh !

klazen108

  • Administrator
  • The Kid
  • Posts: 286
  • your a kid now your a squid now
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 41.0.2272.101 Chrome 41.0.2272.101
    • View Profile
    • Delicious-Fruit
  • Playstyle: Keyboard
Re: Kamilia color change
« Reply #1 on: April 01, 2015, 10:10:24 AM »
Yeah this is a cool gimmick! Here's how I'd implement it :atkHappy:

First off, we all know most deadly objects in fangames have "playerKiller" as their parent:


For this gimmick, the color-dependent objects you make (I'm going to refer to them as red/blue just for the sake of clarity, they don't have to be only red/blue) should not do this. Instead, make two new objects, redPlayerKiller and bluePlayerKiller. Inside each of these, add an end step event with the following code:
Code: [Select]
if (place_meeting(x,y,player)) with (player) if (color != c_red) killPlayer();

Note that the code above is for the redPlayerKiller, make sure to change c_red to c_blue for bluePlayerKiller! You can kinda read it like a sentence: "if I'm touching the player, then if the player's color isn't red, kill him" - that's what we want!

Now, you make your red/blue killer objects, and give those objects redPlayerKiller and bluePlayerKiller for parents.

For the player, add a Key Press <Up> event (can be any key you want, I think it was up in K3?) and add the following code:
Code: [Select]
if (color==c_red) color=c_blue;
else color==c_red;

This will switch the color between red & blue.

In order to show the user what color he has selected, you can draw some white object above him; use player.color for the image_blend and it'll show you the color you are! Take a look at this example object to see what I mean:

Just give that a white sprite, and it'll be tinted red if the player has selected red, and blue if the player selected blue.

Note that the player's going to start out with no color - so make sure you set color=c_red or color=c_blue in the player's create event, or you can add the player's color to the save code (an exercise left to the reader :Kappa: )

Lurpan

  • Wannabe
  • Posts: 18
  • Argentinian player
  • OS:
  • Mac OS X Mac OS X
  • Browser:
  • Safari 6.0 Safari 6.0
    • View Profile
  • Playstyle: Keyboard
Re: Kamilia color change
« Reply #2 on: April 01, 2015, 04:53:04 PM »
Thank you so much klazen  :atkLove:
Im playing fangames shhh !