Please help with checking quadrants and rotation

[COLOR=#000000][FONT=verdana]here’s what I’ve got so far[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]package {[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]import flash.display.MovieClip;[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]public class Main extends MovieClip[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]{[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]public function Main()[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]{[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]// constructor code[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]var hero = new Hero();[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]addChild(hero);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]hero.x = stage.stageWidth / 2;[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]hero.y = stage.stageHeight / 2;[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]var enemy = new Enemy();[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]addChild(enemy);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]enemy.x = Math.random() * (stage.stageWidth - [/FONT][/COLOR][COLOR=#000000][FONT=verdana]enemy.width[/FONT][/COLOR][COLOR=#000000][FONT=verdana]) + [/FONT][/COLOR][COLOR=#000000][FONT=verdana]enemy.width/2[/FONT][/COLOR][COLOR=#000000][FONT=verdana];[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]enemy.y = Math.random() * (stage.stageHeight - enemy.height) + enemy.height/2;[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]And what I need to do next is:[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Use the if-condition to check what quadrant each of[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]the enemies are in, if…[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]• Top right: rotate the enemy instance to 45 degrees[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]• Bottom right: rotate the enemy instance to 135 degrees[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]• Bottom left: rotate the enemy instance to 225 degrees[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]• Top left: rotate the enemy instance to 315 degrees[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]issue is I can’t find what code it is for checking the quadrant this is for an assignment that’s due tomorrow and I can’t find anything[/FONT][/COLOR]

Cant you do like …


var xPos = stage.stageWidth / 2;
var yPos = stage.stageHeight / 2;
if (enemy.x>xPos && enemy.y>yPos){
enemy.rotation = 45
}else if (enemy.x>xPos && enemy.y<yPos){
enemy.rotation = 135
}else if (enemy.x<xPos && enemy.y>yPos){
enemy.rotation = 225
};
enemy.rotation = 315;


hope this helps

You forgot your last else. :wink:

I was close u must admit lol