how can I change view's parent based on a event?

Non-platform specific questions.

how can I change view's parent based on a event?

Postby raminkhan » Sun Dec 25, 2011 6:54 am

Okay I got a character which it hits a ball on the screen after that the ball starts rolling so how can I have the view to change parent and follow the ball from that point on?
raminkhan
 
Posts: 63
Joined: Mon Sep 12, 2011 3:35 pm
Score: 0 Give a positive score

Re: how can I change view's parent based on a event?

Postby skydereign » Sun Dec 25, 2011 9:08 am

In the collision event, you use ChangeParent. By the sounds of it, the player has the collision event with the ball, in which case you can use this.
player -> Collision with ball -> Script Editor
Code: Select all
ChangeParent("view", "Collide Actor");

You can use "Collide Actor" to specify the actor causing the collision event, but only in collision events. If that isn't the event you want, then you may need to do something else, but essentially you just use some form of ChangeParent.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest