Hello people basically I am at university and having trouble with one of my assignments, I am new to actionscripting unfortunatley :(. The first problem I am having is that we are using packages to code the work and I have one object draggable but it does not detect when i try to place it on top of another image.
The other problem is that I do not know how to set an image in a set location while my background is scrolling.
Please help asap thank you
package {
import flash.display.MovieClip;
import VirtualStudent;
import VirtualFood;
public class TamagociGame extends MovieClip{
public var bg:VirtualBackground
public var student:VirtualStudent;
public var food:VirtualFood;
public var targetObject:Object;
public function TamagociGame() {
bg = new VirtualBackground();
addChild(bg);
bg.x=150;
bg.y=stage.stageHeight/2;
student = new VirtualStudent();
addChild(student);
student.x=470;
student.y=260;
}
public function VirtualFoodCollision(student:Object){
food = new VirtualFood()
addChild(food);
targetObject=student;
food.addEventListener(Event.ENTER_FRAME, onFoodEnterFrame);
function onFoodEnterFrame(e:Event):void {
if ( food.hitTestObject(student))
{
food.removeEventListener(Event.ENTER_FRAME, onFoodEnterFrame);
removeChild(food);
}
}
}
}
}