Any way to move a sprite placed with ent_decal ?

Posted By: rayp

Any way to move a sprite placed with ent_decal ? - 02/09/14 05:57

Hi.

Is there any way to move a sprite which was placed via ent_decal ?
Code:
PARTICLE* p = ent_decal(you,bmMark,7+random(3),random(360)); // place a random sized decal at the hit entity 
            p.lifespan = 1600;   // remove decal after 100 seconds
            p.material = mat_model; // assign a dedal material


Using vel_z or p.z in an event does not work ( only with alpha-value to fade out ).
I tryed to use ent_create, but as guessed before, useless...need a decal to fit the surface ( like stain, blood etc ).

So...any way to move a already placed decal-sprite ?
Thanx2all
Posted By: Kartoffel

Re: Any way to move a sprite placed with ent_decal ? - 02/09/14 07:14

isn't there a flag needed for moving patricles confused
Posted By: rayp

Re: Any way to move a sprite placed with ent_decal ? - 02/09/14 07:29

Yes. You mean MOVE.
Does not work. ^^ Seams that decals cant be moved!

fex
Code:
void _testevent (PARTICLE* p){
   p.alpha -= time_step;
   if (p.alpha <= 0) p.lifespan = 0;
 //p.z -= time_step * 2; // wont work too  
}
...
   PARTICLE* p = ent_decal (you, bmMark, 7+random(3), random(360));
   p.material  = mat_model; // mat_particle, mat_sprites doesnt matter
   p.alpha     = 80;
   p.vel_z     =  3;
   p.gravity   =  3;
   p.event     = _testevent;
   set (p, MOVE | TRANSLUCENT);
   /*//and this wont do it also
   while (p && p.z > 0){
      p.z -= time_step * 2;
      wait (1);
   }*/
...

Thats why iam asking grin
Posted By: sivan

Re: Any way to move a sprite placed with ent_decal ? - 02/09/14 08:42

you have to remove the current (or use lifespan 0 I don't remember), and put a new one at new place. it works fine but can be a bit performance expensive, if you have many. somewhere I have a working solution for decal shadows placed by ent_decal, but I never used because of its slow speed in case of a few hundred moving entities...
Posted By: rayp

Re: Any way to move a sprite placed with ent_decal ? - 02/09/14 09:26

Read about that a few hours ago, but as u said, this is no solution. And i wanted to move the decal with BEAM flag activated. Like always : shader ? If so this effect just died for me.

Thanks to both of you anyway.
Posted By: sivan

Re: Any way to move a sprite placed with ent_decal ? - 02/09/14 09:51

what do you want to do exactly? do you really need an ent_decal?
Posted By: rayp

Re: Any way to move a sprite placed with ent_decal ? - 02/09/14 10:46

Yes guess so. The sprite needs to follow the shape of the hit surface. I wanted to upgrade my bloodstain effect. I planned a sprite / particle placed via ent_decal to the target place. Then i wanted to move it slowly downwards with BEAM flag activated to "smear" the blood sprite while moving. I know how to do it with ent_create, but then its not applyed to the target's shape. Shaders i cant write ( and i dont want to ^^ ).
Posted By: the_clown

Re: Any way to move a sprite placed with ent_decal ? - 02/09/14 11:11

alpha_strike had this effect in his zombie game if I remember correctly, and I think he did it with decals, however, I have no idea how. I don't think a shader would solve your problem anyways as decals (again, if I remember correctly) do not work with shaders.
Posted By: Superku

Re: Any way to move a sprite placed with ent_decal ? - 02/09/14 13:58

Decals can use shaders/ materials just fine, although some restrictions may apply.
You could create a new decal every few quants below the last one (don't remove it) and not use BEAM but an appropriate bitmap.
Posted By: rayp

Re: Any way to move a sprite placed with ent_decal ? - 02/09/14 20:24

What a mess! ^^
Posted By: rayp

Re: Any way to move a sprite placed with ent_decal ? - 02/11/14 22:02

Faced another problem maybe a bug. I read in manual that the first decal is removed and a new is set if particles > max_particles. I set max_particles to 10. But only 10 decals are created, then it stops creating. Why? Manual says it removes the first placed decal then.

Can somebody explain this to me ?
Posted By: rojart

Re: Any way to move a sprite placed with ent_decal ? - 02/12/14 05:07

Hi, some time ago i coded Animated decals, if you are interested just pm me.

Click on picture to see the video:

Posted By: gri

Re: Any way to move a sprite placed with ent_decal ? - 02/12/14 07:22

hi rojart,

it works like the solution above with removing old decal and create a new one ?

If you move an existing decal, so I would interested on your code too.
Posted By: rojart

Re: Any way to move a sprite placed with ent_decal ? - 02/12/14 09:47

Second solution, i'll make a contribution about Animated Decals, but a bit later.
Posted By: gri

Re: Any way to move a sprite placed with ent_decal ? - 02/12/14 10:17

hey ho.... that would be nice !
Posted By: sivan

Re: Any way to move a sprite placed with ent_decal ? - 02/12/14 13:12

yeah!
Posted By: rayp

Re: Any way to move a sprite placed with ent_decal ? - 02/12/14 22:30

Ahhh this is community.

@rojart
Great. Iam looking forward to the contribution. Would be nice to see it soon so i dont write a pm. idlemode. ^^

Thanks alot!
Posted By: rojart

Re: Any way to move a sprite placed with ent_decal ? - 02/12/14 23:00

Originally Posted By: gri
hi rojart,

it works like the solution above with removing old decal and create a new one ?


@gri, if you meant eg. me.lifespan = 0.001; i overlooked this in my code and will be first solution, sorry.

@sivan, smile

@rayp, sorry but it's going to take a little bit longer, thanks for your interest.
Posted By: rayp

Re: Any way to move a sprite placed with ent_decal ? - 02/14/14 01:13

Thanks alot. But i hoped ( like gri did ) there would be another way to "move" decals. Anyway great example to learn from when its up to decals.
If that was a bit longer i wonder how fast you are grin

Here's the contribution for all who want to know:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=437309#Post437309

Greets

Edit: Anyway. Whats with that max_particle thing ( my first post on this page ). Still asking myself why this doesnt work.
Posted By: rojart

Re: Any way to move a sprite placed with ent_decal ? - 02/15/14 14:36

Originally Posted By: rayp
...
If that was a bit longer i wonder how fast you are grin
...

It was figuratively, you know work, family, gamble with my son Minecraft and a bit spare time for my best A8 hobby that i've. wink
Posted By: gri

Re: Any way to move a sprite placed with ent_decal ? - 02/15/14 19:12

hey rojart,

even when its not the solution I'm looking for. I appreciate your work and responses.
Since the community shrunk, contibutions and help on problems became rarely.

Thank you.
© 2024 lite-C Forums