# Push actor with another actor

Member, BASIC Posts: 7

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

• Member, PRO Posts: 85

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)

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,944

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:

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

• Member, BASIC Posts: 7

@tatiang said:
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:

Very novice question here, but how do I use or apply that Zip file to my game?

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,944

@Ryanzgrieco There is no way to combine project files so you would need to recreate the rules from the demo in your own game.

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

• Member, BASIC Posts: 7

@tatiang said:
@Ryanzgrieco There is no way to combine project files so you would need to recreate the rules from the demo in your own game.

Thanks for the reply. I guess I'm just confused as to what I am supposed to be looking at when I open the file. Is there a video to watch, or instructions on how to program the action?

• Member, PRO Posts: 4,970
edited December 2019

A quick, simple example. Open the project and take a look at the logic inside and the notes provided for brief explanations of what each thing does. You'll want to reproduce the logic in your own project. There's not much, it's easy to do.

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,944

The zip file from the link I posted last year should contain a project file. It's not mine so I can't promise that but that's generally how demos work. And there's also a video in the Video tab on that same page.

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

• Member, BASIC Posts: 7

This file uses a "self.touch distance" attribute. I cannot seem to find this attribute. Had this attribute changed its name since this was published?

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,944

@Ryanzgrieco If you can't find it, then it means that it is a custom attribute. You would have to create it with that name (or whatever name your choose) and pick the correct attribute type (e.g. integer, boolean, etc.). My guess based on the name of it is that it needs to be an attribute of type real.

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

• Member, PRO Posts: 4,970

Was there something wrong with the example I gave? Seemed to do exactly what you wanted.

• Member, BASIC Posts: 7

@Armelline said:
Was there something wrong with the example I gave? Seemed to do exactly what you wanted.

I apologize.Thank you for your reply. I must have missed it. I will take a look.

• Member, PRO Posts: 4,970