Getting an actor to change after a collision

I have a game where you are the teacher and you are passing out papers to the different students. I have a "Blue Paper" actor constrained to the front of my teacher actor .5 seconds after the teacher spawns. I have another rule that when the Blue Paper collides with the Blue Student, there is a change image to the "Green Paper". This seems pretty simple to me but it just isn't working the way I'm imagining. Ideally I'd like to have a number of random colored students and papers and have each level display a specific number of random colored students. If anyone can provide any guidance on the best way to approach this I would greatly appreciate your help!
http://i50.tinypic.com/2lcb5hj.jpg
http://i50.tinypic.com/2lcb5hj.jpg
Best Answers
-
tatiang Posts: 11,949
I'm assuming that your Blue Student actor is tagged as "desk items" and that the Blue Paper actor does in fact overlap the Blue Student actor and not just the desk itself. Is that right?
Is at least one of the actors' (Blue Paper and/or Blue Student) "Movable" checkboxes checked?
Have you tried creating a new actor with the Blue Paper actor's collide & change image rule and making it large enough to definitely collide with the Blue Paper, and then seeing if that new actor's rule works? I'd be curious to see if you added that new actor and a Log Debugging Statement, whether it is in fact colliding (and whether or not it is changing the image as intended).New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
-
tatiang Posts: 11,949
One of the two actors has to have "movable" checked for collision detection to work. If you need both to have movable checked, try constraining the actor's x & y position or take off the collide behavior so that it isn't being bumped by the other actor.New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
-
tatiang Posts: 11,949
You're welcome! When I do this, I just create a loop with change attribute game.randomPick to random(1,3) and then check to see if game.randomPick is contained in game.alreadyPicked. If not, I do change attribute game.alreadyPicked (text) to game.alreadyPicked..game.randomPick.
@tshirtbooth also has a helpful video that shows how to choose unique random numbers:New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
The intent is now to have the new paper in the teacher's hands change to the color of one of the remaining students in the classroom. So for example the level begins with a green student, a blue student and a red student. The paper that is spawned in the teachers hands is randomly chosen between these three colors. Let's say the red paper is spawned. The teacher then delivers the red paper to the red students desk. The next paper to be spawned should now be one of the two remaining colors, blue or green. Let's say blue is spawned. The teacher then delivers the blue paper to the blue student and the only remaining color, Green, is spawned. The teacher delivers the green paper and the level is complete. Any suggestions on the easiest way to accomplish this?
game.randomPick would be an integer. game.alreadyPicked would be text.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User