Actionscript 3 :: Rotating The Projectiles ALONG With The Spaceship
Sep 4, 2011
I want my spaceship shoot two shots at once. So I used my first array of projectiles and placed them at the right side of the ship (one shot on the left and one on the right). So far so good. But when I shoot with my spaceship and I turn around the rotations of the projectiles look very strange. It's hard to describe so here's an image that shows the error in action. [URL] I have huge problems rotating the projectiles ALONG with the spaceship so that it looks really good. Currently there is one single shot only. My shooting gets screwed up when I rotate and fire at once. The goal is to create a dual firing cannon like in the picture shown. Here is some code that places the projectile at the left of the ship (that doesn't really work):
[Code]....
View 1 Replies
Similar Posts:
Jul 8, 2011
I am wracking my brain over how to figure this out and it is REALLY frustrating me. If we have a cannon on a castle wall that shoots a cannonball from (0,0) toward an enemy that sits below on the ground off to the right at (50,-10) and we want the cannonball to always reach 20 units in the air, how do I make a line function where I can plug x in (which will be 0-50) to calculate y out?
y = -a(x - h)^2 + k
is the equation for this where (h,k) is the vertex. This means k will always be 20. I know to keep 'a' negative because that will give an upside down U parabola. But how do I figure out what 'h' and 'a' are? Systems of equations? How on EARTH would I write a function to do that in Actionscript?
View 0 Replies
Dec 31, 2011
I'm doing a prototype game like Worms and I would like not only to shot, but also see the whole projection curve where my shot will travel before it hit the ground. The only information given by the player is an angle and a power. There is also some level elements like wind and gravity.
Can I have a code for the projection curve? its like a parabola I think. I research about parabola but I had some difficult to apply these math formulas into the programming code.
View 1 Replies
Aug 10, 2010
Im trying to add flames while my spaceship is flying. When forward button is pressed the flame appears from the center of the ship and when the right or left button is pressed the flame appears from the right or left side of the ship, I tried to use gotoAndStop, but it only shows frame by the last pressed button, if I press two keys at same time I see only one flame. What should I do to see two frames at the same time?
View 4 Replies
Jul 22, 2011
I am working on a spaceship flying simulation in PV3D. It's a simple concept, when [SPACE] is pressed, the ship moves forward. The [mouse position] controls the direction the spaceship travels. Similar to this video http:[url].... (though i do not need it to do banks and rolls or anything fancy yet, the video is just to put an image in ur head).I am using these Trig equations to calculate the X, Y, Z velocities,
velocityX = Math.sin (shipdae.localRotationY * Math.PI / 180 ) * speed;
velocityY = Math.sin(shipdae.localRotationX * Math.PI / 180 ) * -speed;
velocityZ = Math.cos(shipdae.localRotationY * Math.PI / 180 ) * speed;
View 1 Replies
Nov 12, 2009
I�m working on an asteroid game and don�t get it to create a nice trail for my spaceship(s).It doesn�t need to look spectacular, just "nice".I tried a comic look alike version with angled mc�s, whose scale are tweened down and up. But it�s not the right look.And I tried some flame effects by as3, but it not seems to be a smart solution. Nice look, but needs a lot of memory space.
View 2 Replies
Jul 31, 2011
i.e. everytime the spaceship reaches a point a new one will be created randomly and the ship is flying to it (etc., etc.)Problem is that it doesn't really work because after the ship flies around for some time it suddenly stops to move. It's a matter of time. Sometimes the problem occurs after 5 seconds then again the spaceships flies around for 2 - 3 minutes and stops the movement immediately.Currently I have no clue where the problem is. I already checked the distance function but so far it seems to be okay
This is the code (just an excerpt):
Code:
private function update(timeDifference:Number = 0):void
{
var step:Number = (timeDifference / 1000) * timeBasedUpdateModifier;
for each (tempEnemy in enemyManager.enemies)
[code]....
View 7 Replies
Nov 14, 2004
im trying to create a basic spaceship flying game and the first problem ive got is controlling the ship. the controls i need are thrust and left-rotate and right-rotate. much like this, [URL] at the start this tut mentions 'game control tutorials' does anyone know where these are? i think i would find these useful. the above tut doesnt go into scripting. at the moment to control rotation i have,
[Code]...
View 4 Replies
Jan 30, 2009
stop a movie clip..... here is my code:
ship_mc.onEnterFrame = function() {
ship_mc._x += 15;
}
What I need is this clip to move until x = 151, then stop. My spaceship will fly across the screen and then stop in the center...how do I make it happen?
View 1 Replies
Nov 14, 2004
im trying to create a basic spaceship flying game and the first problem ive got is controlling the ship.the controls i need are thrust and left-rotate and right-rotate. much like this,[URL]..at the start this tut mentions 'game control tutorials' does anyone know where these are? i think i would find these useful. the above tut doesnt go into scripting.
[Code]...
View 4 Replies
Nov 1, 2005
I have a rotating menu that sets the selected button to the 3:00 position once clicked. I need the labels for the buttons to stay in the upright position as they rotate with the button. I have attached an image. Anyone know of an action script that would keep the labels upright?
View 8 Replies
Jul 1, 2009
would anyone beable to direct me to a tutorial on how to create a rotating circle menu that is driven by xml.
View 6 Replies
May 12, 2010
I have a circular diagram with approximately 8 icons around the outter part of the circle. These points are all buttons. When Clicked, I want the diagram and icons to animate round to the top point (360 or 0 degrees). Then, when another icon is clicked they will all move round so that one is at the top.It would be a great bonus to have a slick easing in motion too but not essential - just a 'nice to have'.I have looked over forums and responses and there is quite a bit of info on this but I'm finding it difficult to apply it to this particular project.
View 2 Replies
Nov 29, 2011
When you drag a mc it rotates. And when you release drag, it stops rotating and it stays at that point.
View 5 Replies
Jun 22, 2009
I have been given the task to create something similar to the flash navigation on the link below. I have tried googling things such as "flash image rotation", "flash rotation circle", etc?[URL]
View 1 Replies
Sep 17, 2009
I am trying to get an object to rotate similar to the globe on this sitei have found the
code:
onClipEvent(enterFrame){
_rotation += (Math.floor(180*Math.atan2(_ymouse,_xmouse)/Math.PI)+90);
[code].....
View 5 Replies
Sep 12, 2008
I have a rotating dial coded in AS3 but I cannot get it to follow with the mouse - It works the way I want it to if I grab opposite to the pointer (so 90 to 180 degrees from the pointer) to rotate the dial. The problem is that I am using the rotation degrees to set a value only in positive numbers ranging from 0 to 240 instead of 0 to 360. If I change the standard rotation code so it tracks with the mouse, it reveals angles -180 to +180 which would screw up the number conversion to positive 0 to 240. I am thinking if I have to change "var r", then "var tr" needs changing to get it back.
View 4 Replies
Nov 28, 2009
how i could make the transition from my last photo to the first photo a more correct transition. maybe my explanation was difficult to understand?? take a look at these two sites(owendawsonphotography.com / owendawsonpga.com) and look at the rotating slide show. when the last image fades out it goes to complete white and the first image comes in at full opacity. I want it to look like the other transitions in the slideshow.
View 1 Replies
Apr 16, 2010
I'm trying to rotate a movieClip from it's original position, to a random anglehere's what I have:
function getRandomNumber(min:Number, max:Number):uint{ var randomNumber:Number=Math.round(Math.random()*(max-min)+min); return randomNumber;}
particles.rotate(angle:getRandomNumber(0,180));
[code]........
View 2 Replies
Feb 9, 2011
I am a complete and utter newbie when it comes to flash. I've bought Flash Professional CS5, and I am looking for a tutorial/help to create a rotating banner ad similar to the one on [url]...
Example: I've got four different pictures I want to rotate within let's say 3-4 seconds per picture. Each of the picture needs its own link, so people can click to get to the correct place. I want the pictures to "fade out to the left" when changing)
View 4 Replies
May 27, 2011
I have a MC that i am moving on to the stage that i want to look as if it rolls in to position. I cant find any referance on how to do this. my code so far is:
//Pic1
PicHolder1.x = 1800;
PicHolder1.y = 322.4;
Tweener.addTween(PicHolder1, {x:161.2,y:322.4, time:1, transition:"linear"});
this gets the motion across but how do i roll it then stop at the end position?
View 3 Replies
Jul 16, 2011
Background info: I am using ActionScript 2.0 and Flash CS5I was working on a game and I used photoshop to save a little gif image. I imported it into flash, "broke it apart", turned it into a movie clip, and put this bit of code on it. It rotates the image when the mouse is moved around it.
Code:
onClipEvent (enterFrame) {
// find x and y differences
[code]........
View 11 Replies
Nov 1, 2011
I am trying to rotate a button in my program that has a large hit box. Obviously, when I do this, the hit box is also rotated and is now in the wrong place. Is it possible to get this hit box to remain static, or to just keep it there?
var turnButton:Tween=new Tween
(sections.lower, 'rotation', Strong.easeOut, 0, 180, 3, true)
View 1 Replies
Apr 16, 2011
I have a problem with rotating and moving my map. I need to spawn buildins along the road and move them. Check the picture. What I want to do is have my player in the middle and rotate the map randomly while the buildings are sliding along the road.
imgur.com/14Ha6 <- Link to the pic
View 1 Replies
Oct 13, 2004
is it possible to rotate an object so that it always faces another object that is able to move around the screen? as in track it on the y and x axis?
View 2 Replies
Feb 18, 2003
my problem is that even if the registration point of the MC I want to rotate is in its center it keeps rotating in its upper left corn.The MC is a jpg I load dynamically.The syntax I use is : _root.photo._rotation += 90;
View 14 Replies
May 5, 2006
I can't seem to find a tutorial on a rotating nav menu like [URL].
View 3 Replies
Jul 26, 2006
concept I can't wrap my mind around.If you've been the the sitehe has a "picture map"I've seen this used at other sites too.But what the rotation. The pictures always rotate around the point you click on.I just don't get it. I understand the momentum and all for the swing though
View 1 Replies
Sep 15, 2006
I'm about to do a menu-system for a pretty wicked site. Not that this menu-system is wicked it's just that I don't get smarter in how to do this. I have searched the net without finding anything similar (but I guess this is pretty simple).I've got an image (from a synthesizer), seen above. My vision is that the center-controlling-device is rotating to a specific spot when clicked (ex: Clicking the "4" will make the center-device rotate so that it points at it).
View 10 Replies
Apr 1, 2007
how to rotate a 2d plane in 3d? for example... i want to load a jpeg in to a movieclip, and then, using actionscript, flip the photo around so essenitally you're looking at the back of it.i've seen the Scripting 3D in Flash kirupa resource, but it's a bit advanced for what i need. i only want to flip a 2d plane 180 degrees.
View 2 Replies