Quantcast
Channel: GameSalad 101 — GameSalad Forums
Viewing all articles
Browse latest Browse all 8928

Actor Bouncing across screen

$
0
0

So I've got this endless runner. My hero flying around trying collect points from things that are spawned just off screen on the right side and scroll across to the left. I've also got a couple of other things like foreground and background objects also doing the same thing. This all works - which is great. I now had the idea (of course, just to make it more difficult) of having an actor be spawned from the right just like all of the rest - except arc to the 'ground' and bounce off screen (left). - just like a ball would do. I looked around and found this discussion: http://forums.gamesalad.com/discussion/74615/keep-object-from-moving-on-y-axis-random-y-position

Someone came up with a solution which worked for the poster, but not for me. Here's what he said to do:

@Rabid Parrot said:
Create a real attribute within the building actor. Call it "MyY".

Add the following statement to the building actor.

Change attribute self.MyY to self.posY

Make another rule,

If self.posY < self.MyY
constrain attribute self.posY to self.MyY

What I've also done is enter a value (3) into the Y coordinate of Gravity in the scene attribute and applied the above. My actors still slide off screen - downward.


Viewing all articles
Browse latest Browse all 8928

Trending Articles