The Daily Click ::. Forums ::. Klik Coding Help ::. Help with Blood Effect
 

Post Reply  Post Oekaki 
 

Posted By Message

Jim Joe Johnson



Registered
  28/03/2004
Points
  45
27th May, 2004 at 15:26:13 -

Yo. I'm working on a side-scrolling shooter called World Gone Rabid, and just made a cool blood effect for it. The blood is an active object that I have move to the enemies' location when they're hit. My problem is, when the enemy moves away, the blood just stays there. How do I get the blood to stick to the enemy?

 
"Nasty, tricksy Hobbitts!"

Jim Joe Johnson



Registered
  28/03/2004
Points
  45
27th May, 2004 at 17:21:51 -

Somone help please.


 
"Nasty, tricksy Hobbitts!"

Jimmy Brzezicki



Registered
  16/09/2003
Points
  1057
27th May, 2004 at 17:22:13 -

It's probably best to create the blood effect relative to the enemy, so you can have more than one blood at the same time. When you do that make sure it sets a flag on, and then say that when that flag is on set blood possition relative to the enemy at (0,0) (or whatever works). That ought to work.

 
Why the hell am I on the computer at 1 in the morning? No, don't answer.

Jim Joe Johnson



Registered
  28/03/2004
Points
  45
27th May, 2004 at 17:24:54 -

That wont work. If i did that, whether the enemy was hit in the face or the arm by the bullet, the blood would be in the same place!

 
"Nasty, tricksy Hobbitts!"

Arf :: FPP Games



Registered
  15/05/2002
Points
  1364
27th May, 2004 at 18:22:03 -

When the collision occurs:

Set Value A of "blood" to X(Blood) - X(Enemy)

Set Value B of "blood" to Y(Blood) - Y(Enemy)

Always (when enemy has been hit):

Set X of "blood" to X(Enemy) + Value A(Blood)
Set Y of "blood" to Y(Enemy) + Value B(Blood)

Hopefully this makes sense.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
27th May, 2004 at 21:22:22 -

As a minor tip, you might might also consider having the blood vanish when the enemy turns around. You could have it simply flip sides, but that tends to look really fake.
Alternatively, you could make the blood invisible when it turns around, and have different blood depending which direction the enemy is facing. However, simply destroying it when the enemy turns is a good excuse to cut down on the number of active objects. That all depends on how many hits each enemy takes, of course.

Also, if you've got multiple duplicates of the same enemy using the same blood objects, you can give each enemy a random identifier value (out of, say, 10,000) and give that value to the blood when it's created. That way you can make sure the blood is sticking to the right enemy, especially when the paths of two enemies cross.
Eg:

Bullet collides with enemy
--Create blood
--Set blood.C to enemy.C
--[set other variables for the right position, as Arf said]

Enemy.C == Blood.C
--Set X(blood) to X(Enemy) + Blood.A
--Set Y(blood) to Y(Enemy) + Blood.B

That'll just make sure the object focus is set properly. It'll also help when an enemy dies and you want to remove its attached blood, which can be tricky if you've got two overlapping enemies.

 
http://www.klikscene.com

AsparagusTrevor

Mine's a pint of the black stuff

Registered
  20/08/2002
Points
  2364

Game of the Week WinnerHas Donated, Thank You!VIP MemberEvil kliker
28th May, 2004 at 13:39:08 -

I once tried to do that, it's not easy. Best thing would be to have the blood not spawn exactly where the bullet hits, and have a sprite that gets bloodier and bloodier as more bullets hit. So have the sprite have an animation, then a bloodier animation, then an even bloodier one etc. It isn't precise, but it looks okay.

Image Edited by the Author.

 
Image
   

Post Reply



 



Advertisement

Worth A Click