Change Movieclip's angle?

6 posts

Flag Post

I want my character to change angle when he walks up hills. Can I do something like :

onClipEvent(enterFrame) {
	if(_root.char.hitTest(this)) {
		char's angle = 45
	}
}

Is there any code to change a movieclip’s angle when it touches something?

 
Flag Post
Originally posted by Shadow_Craver:

I want my character to change angle when he walks up hills. Can I do something like :

onClipEvent(enterFrame) {
	if(_root.char.hitTest(this)) {
		char's angle = 45
	}
}

Is there any code to change a movieclip’s angle when it touches something?

Do you mean like rotation? You could do char.rotation = 45; and it will change it’s rotation.

 
Flag Post

Hes using as2 according to “_root”, so it’s _rotation instead of rotation.

 
Flag Post

Hey guys, it’s not working. I tried this:

onClipEvent(enterFrame) {
	if(_root.char.hitTest(this)) {
		_root.char.rotation = 45;
	}
}

In the ground’s actions, nothing happens. I tried changing 45 to 90 but still nothing.

 
Flag Post
Originally posted by Shadow_Craver:

Hey guys, it’s not working. I tried this:

onClipEvent(enterFrame) {
	if(_root.char.hitTest(this)) {
		_root.char.rotation = 45;
	}
}

In the ground’s actions, nothing happens. I tried changing 45 to 90 but still nothing.

Change _root.char.rotation = 45; to _root.char._rotation = 45;

 
Flag Post

It worked, thanks :)