GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Push actor with another actor

I'm working on a game where the actor spawns with a touch or mouse press (green actor in video), and pushes another object (red actor in video).

I am able to get the red actor to bounce when it lands on top of the green, but it will not bounce when it collides from the side.

Also, i would not like to be able to spawn the green actor when its boundaries are pressed within the boundaries of the red actor. currently, it causes the red actor to jump to the outside boundaries of the green.

Any suggestions as to how to solve this?

Any help would be appreciated. Thank you. https://youtube.com/watch?v=a0XhvqYmHOo&feature=youtu.be

Comments

  • mikejamesfishermikejamesfisher Posts: 55Member, BASIC

    Since the red actor has gravity pulling it down, It wouldnt bounce from side too much. I dont know the best way to solve it... you can try something like adding move behavior left to red actor when collides with green actor if green actor’s position is greater than the x,y position of the red actor(green is on right of red). If it is less move red actor right. That is probably pretty clumsy but im a clumsy programmer.... and add a rule to the spawning of the green actor- when touch is pressed outside red actor. (I dont have gamesalad open. Not sure that is exactly how to do it. Hopefully someone has better ideas)

  • tatiangtatiang Posts: 11,569Member, Sous Chef, PRO, Senior Sous-Chef

    I think you're going to have a hard time using collision rules if you're constraining the position of the green actor which is what it looks like in the video.

    There's an old method that might work for you:

    https://gshelper.com/product/constrain-to-mouse-and-keep-collision-gamesalad/

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.