I have written my game slingshot game in flash and now I need to import it into flash builder and make the necessary changes to get everything on the stage in its proper place and make it work on a mobile device. After that is done I will need an fxp file so that I can import the game into my own flash builder and continue working on it. Please help. I have included the zip folder with all my actionscript files. I also already created the sprite sheet so the png file and xml document are both in there. It just needs to be embedded and everything put onto the stage in its proper place. You can see where I placed everything in the fla file.
SlingShot/._slingShot.swf
SlingShot/accelerometer.as
import flash.sensors.Accelerometer;
var theAcc:Accelerometer = new Accelerometer();
theAcc.setRequestedUpdateInterval(50);
if (Accelerometer.isSupported == true)
{
trace(“is supported”);
}
else
{
//do something if its not
//instructions.visible = flase
}
theAcc.addEventListener(AccelerometerEvent.UPDATE, onAccUpdate);
function onAccUpdate(event:AccelerometerEvent):void
{
if (ball.x > point2.x)
{
vel.x -= (event.accelerationX * 1);
}
}
SlingShot/clockTimer.as
SlingShot/collisions.as
function detectCollisions()
{
//block collision
if (blockOutline.hitTestPoint(ball.x,ball.y,true))
{
hitblockOutline = true;
vel.x = vel.x * -1;
}
//box collision
if (outline.hitTestPoint(ball.x,ball.y,true) && hitOutline == false)
{
hitOutline = true;
vel.x = vel.x * -1;
}
//the target
if (theTarget.hitTestPoint(ball.x,ball.y,true) && ball.visible == true)
{
ball.visible = false;
acc.x = 0;
acc.y = 0;
vel.x = 0;
vel.y = 0;
trace (“you win”);
resetPlay();
}
}
SlingShot/doConstantly.as
import flash.events.Event;
addEventListener(Event.ENTER_FRAME, doConstantly);
function doConstantly(event:Event):void
{
//main code for gravity affect ball and other stuff…
acc.x = 0;
acc.y = gravity;
if (released == true)
{
//if you have let go of ball
/*vel.x += acc.x;
vel.y += acc.y;*/
ball.x += vel.x;
ball.y += vel.y;
//ball.rotation += vel.x;
}
//this will make sure the ball doesnt dissappear off stage
if (ball.x > stage.stageWidth || ball.x < 0 || ball.y < -500 || ball.y > stage.stageHeight + 100)
{
resetPlay();
}
//below draw elastic string
elastic.graphics.clear();
elastic.graphics.lineStyle(0.5, 0x9999999);
if (ball.y > point1.y && ball.x < point2.x)
{// the ball falls within range of bending the string
forced = true;
var x1:Number = ball.x - point1.x;
var y1:Number = ball.y - point1.y;
var x2:Number = point2.x - ball.x;
var y2:Number = point2.y - ball.y;
var distance1:Number = Math.sqrt(x1*x1+y1*y1);
var distance2:Number = Math.sqrt(x2*x2+y2*y2);
angle1 = Math.atan2(y1,x1);
angle2 = Math.atan2(y2,x2);
var xOffset:Number = Math.cos(angle1+Math.PI/2)*radius;
var yOffset:Number = Math.sin(angle1+Math.PI/2)*radius;
var xOffset2:Number = Math.cos(angle2+Math.PI/2)*radius;
var yOffset2:Number = Math.sin(angle2+Math.PI/2)*radius;
angle1 += Math.sin(radius/distance1);
angle2 += Math.sin(radius/distance2)*-1;
elastic.graphics.moveTo(point1.x, point1.y);
elastic.graphics.lineTo(ball.x+xOffset, ball.y+yOffset);
elastic.graphics.moveTo(point2.x, point2.y);
elastic.graphics.lineTo(ball.x+xOffset2, ball.y+yOffset2);
}
else
{
// the ball falls out of range of bending the string;
forced = false;
elastic.graphics.moveTo(point1.x, point1.y);
elastic.graphics.lineTo(point2.x, point2.y);
}
// makes the ball bounce back up;
if (released == true && forced == true)
{
acc.x += distance1 * Math.sin(angle2) * elasticCoefficient;
acc.y += - distance1 * Math.cos(angle1) * elasticCoefficient;
acc.x += distance2 * Math.sin(angle1) * elasticCoefficient;
acc.y += - distance2 * Math.cos(angle2) * elasticCoefficient;
}
if (released)
{
vel.x += acc.x;
vel.y += acc.y;
}
//prevent you from moving can over the target
if (released == false && ball.x >point2.x) {
ball.stopDrag();
released = true;
resetPlay();
}
//calling collision functions
detectCollisions();
}
SlingShot/initials.as
import flash.display.MovieClip;
import flash.events.Event;
import flash.sensors.Accelerometer;
import flash.events.AccelerometerEvent;
stop();
var blockStarting:Object = {x:block.x , y:block.y};
var ballStarting:Object = {x:ball.x , y:ball.y};
trace (ballStarting.x, ballStarting.y);
var stick1Starting:Object = {x:stick1.x, y:stick1.y};
var stick2Starting:Object = {x:stick2.x, y:stick2.y};
var point1Starting:Object = {x:point1.x, y:point1.y};
var point2Starting:Object = {x:point2.x, y:point2.y};
var boxStarting:Object ={x:box.x, y:box.y};
//trace (boxStarting.x, boxStarting.y);
var theTargetStarting:Object = {x:theTarget.x, y:theTarget.y};
//trace (theTargetStarting.x, theTargetStarting.y);
var gravity = 0.15;
var angle1:Number = 0;
var angle2:Number = 0;
var radius:Number = 1;
var elasticCoefficient:Number = 0.0045;
var released:Boolean = true;
var forced:Boolean = false; //whether or not it is being pulled down between the sticks
var acc:Object = {x:0, y:0};
var vel:Object = {x:0, y:0};
var hitOutline:Boolean = false;
var hitblockOutline:Boolean = false;
var hittheTarget:Boolean = false;
var elastic:MovieClip = new MovieClip();
addChild (elastic);
SlingShot/mouseEvents.as
import flash.events.MouseEvent;
ball.addEventListener (MouseEvent.MOUSE_DOWN, ballDown);
function ballDown(event:MouseEvent)
{
resetPlay();
ball.x = mouseX;
ball.y = mouseY;
ball.startDrag();
released = false;//gravity will not affect ball when false
}
stage.addEventListener (MouseEvent.MOUSE_UP, ballUp);
function ballUp(event:MouseEvent)
{
ball.stopDrag();
released = true;// gravity will affect can
}
SlingShot/resetPlay.as
function resetPlay() {
hitblockOutline = false;
hitOutline = false;
hittheTarget = true;
ball.x = 89.5;
ball.y = 170.05;
vel.x = 0;
vel.y = 0;
acc.x = 0;
acc.y = gravity;
block.x = blockStarting.x;
block.y = blockStarting.y;
point1.x = point1Starting.x;
point1.y = point1Starting.y;
point2.x = point2Starting.x;
point2.y = point2Starting.y;
stick1.x = stick1Starting.x;
stick1.y = stick1Starting.y;
stick2.x = stick2Starting.x;
stick2.y = stick2Starting.y;
box.x = boxStarting.x;
box.y = boxStarting.y;
theTarget.x = theTargetStarting.x;
theTarget.y = theTargetStarting.y;
}
SlingShot/slingShot.fla
SlingShot/slingShot
SlingShot/slingShot.swf
SlingShot/slingShot.xml
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Achiever Papers is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Dissertation Writing Service Works
First, you will need to complete an order form. It's not difficult but, if anything is unclear, you may always chat with us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order form
Once we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignment
As soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download