The Daily Click ::. Forums ::. Klik Coding Help ::. how do you make a character "blink" when hit?
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
19th October, 2010 at 22:33:40 -

so yeah, ive tried the Flash character command thingy but all it does is make my character go invisible, and i cant get them to re-appear. how do i make my character blink when they get hit for a certain amount of time?

 
[Game design makes my brain feel like its gonna explode.]

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
19th October, 2010 at 22:50:54 -

The flash object action makes the object flash once for the amount of time you put in the expression.
If you trigger this action faster than the action lasts (like an "always" condition), then the object won't have the time to reappear.

 
...

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
19th October, 2010 at 23:01:50 -

so than how do you make a character stop flashing after a certain amount of time?

 
[Game design makes my brain feel like its gonna explode.]

Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
20th October, 2010 at 00:53:23 -

Make it visible again.

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
20th October, 2010 at 00:54:43 -

'Make object reappear' make it stop flashing too.

 
.

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
20th October, 2010 at 01:15:43 -

Seems like I was wrong; the action only needs to be triggered once. I apologise.

 
...

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
20th October, 2010 at 01:39:23 -

Yeah that time interval stuff is for the flash speed not how long the flash lasts.

You can make it stop after a certain amount of time by using a seperate value (a counter an alterable value or a global value etc)

just set the value to say... 200.
then make another event that makes it subtract by 1 if it's above 0
then when the counter reaches 0 make object visible.

 
.

7Soul



Registered
  12/08/2008
Points
  167
20th October, 2010 at 05:32:04 -

I did this in my game another day like this:

Character hit -> Set "blink" to 60

"blink" > 0
+ restrict actions for 00'07 -> substract 1 from "blink" AND set character semi-transparency to ("blink" mod 2)*128

"blink" < 0 -> set character semi-transparency to 0

"blink" is a alterable value of the character
This action basicaly makes the transparency toggle between 0 and 128, which means visible and not visible

Edited by 7Soul

 
n/a

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
27th October, 2010 at 06:22:14 -


Originally Posted by 7Soul"blink" > 0
+ restrict actions for 00'07 -> substract 1 from "blink" AND set character semi-transparency to ("blink" mod 2)*128



I might sound like an idiot, but why restrict actions for 00'07? Why not just make the value for blink larger?

Usually I put those values in a separate place, for instance, I'll create a blank active object and store Constant values in it. For instance, a setBlink variable on that active set to 60, then when you trigger it, set "blink" to "setBlink", that way, if you ever need to tweak it, you don't have to hunt around for it in your code (especially more useful if you have that specific number in multiple places). It also makes your code a ton more readable, rather than throwing magic numbers all over the place.

 
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
27th October, 2010 at 06:48:16 -


Originally Posted by HorrendousGames

Originally Posted by 7Soul"blink" > 0
+ restrict actions for 00'07 -> substract 1 from "blink" AND set character semi-transparency to ("blink" mod 2)*128



I might sound like an idiot, but why restrict actions for 00'07? Why not just make the value for blink larger?

I think it would be so that the object does not instantly begin blinking. Making the blink value larger would do nothing for that here as it is based on the remainder of the value divided by two, meaning if the number is even the object is visible, and if it is odd, invisible. Subtracting only 1 at a time means that it toggles with every frame. Increasing the blink value would just make it blink for a longer time.

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
27th October, 2010 at 06:50:40 -


Originally Posted by Jon Lambert

Originally Posted by HorrendousGames

Originally Posted by 7Soul"blink" > 0
+ restrict actions for 00'07 -> substract 1 from "blink" AND set character semi-transparency to ("blink" mod 2)*128



I might sound like an idiot, but why restrict actions for 00'07? Why not just make the value for blink larger?

I think it would be so that the object does not instantly begin blinking. Making the blink value larger would do nothing for that here as it is based on the remainder of the value divided by two, meaning if the number is even the object is visible, and if it is odd, invisible. Subtracting only 1 at a time means that it toggles with every frame. Increasing the blink value would just make it blink for a longer time.



Sorry, I misread the code, I was under the impression that the code was only to subtract from the value, and had nothing to do with the actual blinking, for some reason I was thinking that was in a separate line of code.

Bonehead moment, my bad.

 
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
16th November, 2010 at 02:13:25 -

I believe a much easier way is to just have a hit animation... but then again, I could be wrong...

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

7Soul



Registered
  12/08/2008
Points
  167
16th November, 2010 at 02:49:34 -

But then the character will be stuck on 'hit animation' for some time, like, if you get hit, the hit animation goes off, and you start walking, but the hit animation will still be on. With that code i posted, you can blink and that won't affect your current animation

 
n/a

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
16th November, 2010 at 02:53:56 -

not really... If you had a flag for whether your'e hit or not, and when youre hit it restricts your actions, and it turns off every x seconds and when its off it restores the animation sequence.

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.
   

Post Reply



 



Advertisement

Worth A Click