Stencyl 3.4.0 is now out. Get it now!

Shared Mechanics

colburt187

  • *
  • Posts: 2051
Ive attached a slow motion behaviour I have used in a lot. Its very simple to use. I have made it a scene behaviour but it would also work attached to and actor.

Bhoopalan

  • *
  • Posts: 988
To simulate elasticity effect I always use trig functions:
   
<a href="http://static.stencyl.com/games/34050-0.swf" target="_blank" class="new_win">http://static.stencyl.com/games/34050-0.swf</a>

Did you draw the rope separately (like in the other behavior) that isn't shown in this snippet? I cant see the rope being created.
If I helped you at anytime, help me back build my twitter followers :)
https://twitter.com/imbhoopalan

LIBERADO

  • *
  • Posts: 2379
Did you draw the rope separately (like in the other behavior) that isn't shown in this snippet?
Yes.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Bhoopalan

  • *
  • Posts: 988
Thanks.

Thanks to Everyone from Ceosol, Liberado, mdotedot, SadiQ, colburt & poehyrulian for sharing your inputs. Many of the behaviors you people have shared would be difficult to accomplish without such help.

Special thanks to Ceosol for this initiation.
If I helped you at anytime, help me back build my twitter followers :)
https://twitter.com/imbhoopalan

SomeT

  • *
  • Posts: 143
What is the most easiest way to achieve a particle effect upon an enemy hitting a player? Not looking for anything fancy, as long as it don't eat up memory and is really simplistic?

squeeb

  • Posts: 1097
Im using the explode on death behavior to make the rain drops splash.. you can do the same im sure, i have simple physics and no collsions on the droplets... they are small so im not sure if theyre rotating.. running at 60fps

<a href="http://static.stencyl.com/games/35967-0.swf" target="_blank" class="new_win">http://static.stencyl.com/games/35967-0.swf</a>

ceosol

  • *
  • Posts: 2118
I use image API or creating simple actors.
What is the most easiest way to achieve a particle effect upon an enemy hitting a player? Not looking for anything fancy, as long as it don't eat up memory and is really simplistic?

SomeT

  • *
  • Posts: 143
"explode on death behavior"??? What do you mean by this, could you please elaborate because there is no block for this from what I can see.

"I use image API or creating simple actors."

Could you please elaborate on this also please?

squeeb

  • Posts: 1097
http://www.stencyl.com/help/view/pre-shipped-behaviors/
http://www.stencyl.com/help/view/introduction-to-behaviors/
there is a behavior packaged with stencyl that says explode on death.. you pick different actors to be spawned  in the behavior when the actor dies.. like blood or explosions... i just did drops... when the rain drop actor "collides with anything block" kill self.. attach the behavior to rain drop actor.. then i made droplet actor( is what spawns when rain drop actor dies)..  and programmed what that does..

SomeT

  • *
  • Posts: 143
Ah, apologies, I never use those, I always try and program it myself as I just started out with stencyl, I can give it a try though, many thanks.

squeeb

  • Posts: 1097
no problem :) you can even see the code if you want to change anything or take it out of the behavior.. seem  organized this way

SomeT

  • *
  • Posts: 143
Ok so I added that behaviour you mentioned, now when I run my game it crashes completely, I tried to turn collisions off but then my game does not do what I need it to do for the collision based aspects (die upon collision)

ceosol

  • *
  • Posts: 2118
"I use image API or creating simple actors."

Could you please elaborate on this also please?
I don't really use premade code from others. Just like you, I enjoy creating the things from scratch.

So with image API, you can create instances of something. For example, upon "death" of an object, instead create a bunch of image instances of the actor. Hide the original actor, while removing any physics (to prevent further collisions). You can then send the image instances wherever you want on the screen as particles. Whenever you want to get rid of all of them, just kill the original actor and all of its image instances will go away.

Another example of image instances is permanence. You can have a gun shell casing land on the ground and then attach an image of itself to the screen. That way you can kill the actor and allow the shell casing to permanently remain. Likewise, you can have a "damaged spot" appear on the player by creating an instance and attaching it to the player actor. That instance can then stay as long as you want.

Using actors as particles is similar to creating a Snake game. You create an actor and give it some lifespan. If you continue creating actors moving in a certain directional (all with similar lifespans), you could create a smoke or explosion effect.


SomeT

  • *
  • Posts: 143
http://www.stencyl.com/help/view/pre-shipped-behaviors/
http://www.stencyl.com/help/view/introduction-to-behaviors/
there is a behavior packaged with stencyl that says explode on death.. you pick different actors to be spawned  in the behavior when the actor dies.. like blood or explosions... i just did drops... when the rain drop actor "collides with anything block" kill self.. attach the behavior to rain drop actor.. then i made droplet actor( is what spawns when rain drop actor dies)..  and programmed what that does..


"collides with anything block"

Where is this block? I think this is why my game is crashing because the new fragments, I am not killing them off quick enough so they are filling my screen up.

ceosol

  • *
  • Posts: 2118
Where is this block? I think this is why my game is crashing because the new fragments, I am not killing them off quick enough so they are filling my screen up.
Use math. It is always cheaper on system resources to have simple physics and use math.

if x of actor1 < x + width of actor2 AND x + width of actor1 > x of actor2
(do the same for y)
          kill actor1