I was messing around with some ideas the other day and I decided to work on some visual effects. If you played Castlevania, you notice that when you get hit or die, particles of blood spray from you randomly other than using a pre-made sprite. It gives it a more realistic feel and makes it look neater, in my opinion.
What I ended up doing to replicate that effect was spawning multiple instances of the same object and changing the pixel_x and pixel_y randomly of each object. I hard-programmed that 10 different objects spawn when the proc is called.
My question to you is: Would this be a good method to achieve this, or is there some sort of issue that should be taken into consideration when creating that many objects at the same time? Also, is there a method to spawn multiple objects at the same time without having to hard-code them?
ID:151738
Jun 15 2009, 7:47 pm
|
|
Jun 15 2009, 11:00 pm
|
|
I'd just use the missile() proc with some random turfs as targets. (At least, that's what I do to make puffs of smoke pop out of traveling robots in Gears & Peers.) I wouldn't bother with actual atoms for a purely visual effect. =)
|
I guess the most desirable method depends on exactly what visual effect you want. I don't think your method would cause problems (unless you have really a LOT of objs and so are in danger of hitting the limit, but that's a non-issue), just make sure you don't create too many objs that it takes too much CPU time. Also, if you can, try to cut down on objs by using other, visual-only methods (what's for sure is that visual-only effects shouldn't be interactable). These include (pixel-offset) overlays and /image objects (I don't think missile() would be very suitable here, but you can give it a try).
ArcaneDragonX wrote: Also, is there a method to spawn multiple objects at the same time without having to hard-code them? Uhm, well, there should be... you don't have to hardcode it (by duplicating code for each obj) if you just use loops? I don't know the exact manner of the spawning you want, so I can only give a random example. proc/Create_Objs(num_of_objs,turf/baseloc) EDIT: Forgot the sleep(). xD |
In response to ACWraith
|
|
obj/bloodspatter Still not sure if I quite like how it turned out. Going to fiddle around with it some more, I think. One comment is that about a third of the particles get "wasted" by going to an adjacent turf and very quickly disappearing (after only one or two ticks). This reduces the volume of it, but I think it looks better, giving a bit more of an initial impact. You can add - oview(center.loc, 1) to the turfs declaration to compare. The little diagrams show what the resulting choice of turfs is. Might have preferred the diagonal one to be more triangular but I wanted to stick to bitwise operations to save time. |
In response to Garthor
|
|
Ah, missile() IS suitable for this! That looks very nice. =)
|
In response to Kaioken
|
|
I decided to work on this a bit more. I changed the shapes to be rounded (or else the diagonal missiles last noticeably longer) and made narrow and wide directional spatters. I also added pixel offset arguments so you can, for example, center the spatter on somebody's crotch, head, crotch, arm, crotch, etc.
//actually performs the graphical work of the bloodspatters, for code reuse purposes |