How to have the particles appear at the point where the 2 actors collide?

sSHAKESssSHAKESs Member Posts: 27
edited October 2012 in Working with GS (Mac)
Hello, guys! I have a question about particles...

How do I make the particles appear at the point where they both collide? Right now, the particle appears at the actor's center since it's at 0,0.

Thank you, guys! =)

Comments

  • JuggerJugger Member, PRO Posts: 238
    just spawn one more actor with particles
  • gamesfuagamesfua Member Posts: 723
    Just a heads up you can always say spawn at actors self x and self y positions- and then add some numbers. Meaning if lets say you wanted the spawn to occur a few pixels above the actor just say spawn at self position y+8 (or however many pixels you want up, etc.).
    So that's one thing you can do. You can also make your particle explosion slightly bigger so it appears like its blowing up over both.
    I have another idea that may work but its a little more complex. It would be more precise but i'd like to see if anyone else with more experience can suggest something first. I'd hate to make you do more work than necessary.
    In the meantime play around with spawning the particles a few pixels away from the actors center point (like mentioned above). Perhaps add a rule that checks what side the other actor is coming from. For instance if BadGuy position X is greater than goodguy position x and collide, than spawn particle explosion at self position xy of goodguy+7.
    Unfortunately this would require having lots of constrains. I'm very sure there's a better and simpler way of doing this.
    Oh and btw please let me know if everything above seems like jibberish ;)
  • gamesfuagamesfua Member Posts: 723
    If no one helps you out take a look at searches for collision points in gamesalad. May help you out. The way i'm seeing this is either throught the use of some possible trigonometry or invisible actors constrained to your actors. I'm looking forward to other peoples hopefully easier suggestions.
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Not sure if this is the effect your looking for, but I thought I'd post it anyway.

    http://gshelper.com/?p=372
  • gamesfuagamesfua Member Posts: 723
    That's pretty darn neat @Braydon_SFX but do you know how to register the exact point of collision? All i can think of is either using invisible constrain actors atop an actor or trying to register the magnitude between two actors colliding. Both may be (and probably are) more complex than necessary. Any ideas to help sshakess out? Or maybe, and hopefully the video you provided is just what sshakess needed :)
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    This only works well with circular actors but might be what you want. In the particles behavior use these for the x and y offsets:

    Emitter Offset>: (self.Size.Width/2)*sin(90-vectorToAngle(otherActor.X-self.Position.X, otherActor.Y-self.Position.Y))

    Emitter Offset^: (self.Size.Height/2)*cos(90-vectorToAngle(otherActor.X-self.Position.X,otherActor.Y-self.Position.Y))
  • sSHAKESssSHAKESs Member Posts: 27
    Hello! You guys are awesome. All of you. Thank you!

    @anatomyofdreams I want the explosion to happen at the point where they touch. Since it's a ball, it can be anywhere around the ball and can't really be a fixed point. There might be a formula for that but I don't know what.

    I've decided to just do the effect in After Effects instead of the particle system in GS. I think it's easier that way. But I still have no idea how to make that animation appear at the point of impact.

    @Braydon_SFX thanks for the video. I have seen that before but it seems the explosion happens at the center of the actor.

    @RThurman I haven't tried this yet... I'll try it and let you guys know. I wish I can fully understand all these expressions... =(
  • sSHAKESssSHAKESs Member Posts: 27
    @RThurman I just tried this and the particles still originate from the center of the actor. =(
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @sSHAKESs -- the expression can't be cut & pasted. They need to be built with the expression editor. Also, "otherActor.X" is an attribute you would create. It holds the other actor's x position. (Same with "otherActor.Y".)
  • sSHAKESssSHAKESs Member Posts: 27
    @RThuman Yes... I realized that, too! Haha! It still doesn't work... what is otherActor.X? Can I just type that in?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
  • sSHAKESssSHAKESs Member Posts: 27
    @RThurman Thanks a lot, dude! Thanks for the sample. Now I really understand it. But I still can't make it work. =(
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Do you mean that the demo does not work? Or do you mean that you can't get the equations to work in your game? I am afraid that you will need to be more descriptive.
  • sSHAKESssSHAKESs Member Posts: 27
    @RThurman Haha! Sorry, sir. I meant it didn't work for my game. Can't seem to work for some reason. Your sample worked great! =)
  • sSHAKESssSHAKESs Member Posts: 27
    Can I pay someone to actually help teach me one on one? I have a short list of stuff that I can't solve. =(
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    I think that there are several people on this forum who can help tutor someone. You might want to look in the signatures block of some of more visible forum members and see if they offer one-on-one tutoring.

    In addition, there are at least two/three books on GameSalad development. You can do a search to find them. I am not sure if he still offers his book, but @Photics self published a textbook that I found extremely helpful. GameSalad will be publishing their own official book in Feb./March 2013.

    There are also many online resources that answer specific questions. You should look in the signature block of many of the forum members who have created really great video tutorials. There is a gold mine of information about GameSalad!

    Personally, I think that the best learning happens when someone finally realizes the question they are really asking and then focuses in on it. My recommendation would be to go over the free and publicly available materials mentioned above and then ask specific question when there is no information. Learn by doing!
Sign In or Register to comment.