[FONT=Verdana]I am creating a game, mostly for learning, but its also fun. I am adding enemies to the stage, ships, and i want them to sail across, which they do. But I don’t know how to make them look smaller if they are farther away (higher on the stage) or big if they are close (lower on the stage) help? thanks in advance.[/FONT]
[FONT=Verdana]Here is my ship class code:
[/FONT]
package{
import flash.display.Sprite;
import flash.display.Graphics;
import flash.text.TextField;
import flash.display.MovieClip;
public class Enemy extends MovieClip{
private var health_txt:TextField;
private var health:int;
private var speed_x:Number;
private var speed_y:Number;
private var scale_x:Number;
private var scale_y:Number;
public function Enemy() {
health = 2;
speed_x = -1.5;
speed_y = 0;
addShip();
draw();
}
private function addShip():void{
var newShip:testShip = new testShip();
this.addChild(newShip);
}
private function draw():void {
health_txt = new TextField();
health_txt.height = 40; health_txt.width = 30;
health_txt.textColor = 0xffffff;
health_txt.x = 40;
health_txt.y = -40;
health_txt.text = health + "";
addChild(health_txt);
}
public function update():void {
x += speed_x;
y += speed_y;
}
public function updateHealth(amount:int):int {
health += amount;
health_txt.text = health + "";
return health;
}
}
}
[FONT=Verdana]
[/FONT]