Actionscript 3 :: Rotates Towards The Mouse And Shoots?
Apr 22, 2011
I am pretty new to action script 3 (I did a little bit in as2) and i am trying to create a laser gun that rotates towards the mouse and shoots when the mouse is fired.
kind of like this but in as3[URL]..
View 4 Replies
Similar Posts:
Oct 11, 2009
How can I do a movieclip that rotate himself when mouse is over it ?
would be nice there was a acceleration at the beginning and a deceleration to the end.
View 2 Replies
Nov 7, 2009
this is what i've managed to do so far:
[URL]
But as you can see it isnt smooth at all! Does anyone have any better code i can use?
This is the code i have written to do it:
Code:
var px = mouseX;
var py = mouseY;
this.addEventListener(MouseEvent.MOUSE_MOVE,moveMouse);
[Code].....
FLA: [URL] (you might have to right click on that and click "Save target as"
View 6 Replies
Feb 20, 2011
I'm trying to make it so that and object rotates to the mouse, but only within a specific range. In the class file for Object1, I want it to be able to rotate a maximum of 45 degrees in either direction from the rotation of Object2. So far this is all I could come up with:
[Code]....
The possible rotations of Object2 are 0, 45, 90, 135, 180, -135, -90, and -45. The code seems to work fine if the rotations are between -90 and 90 (the right half), but because the left half goes from -179 to 180 to 179, it obviously fails. How would I accomplish the effect I want?
View 0 Replies
Apr 12, 2007
I have a tree movieclip that when clicked, will duplicate itself and the duplicated movieclip will be dragged, using this code:
Code:
onClipEvent (load) {
var i = 0;
if (this._name != "tree") {[code]....
BUt it only rotates when i am moving the mouse?
View 1 Replies
Apr 23, 2010
Been making a site and came across a problem. I want to have a ship movieclip follow the mouse slowly and rotate and flip on horizontal axis according to the mouse potition. I've been looking on this Here's the code on the timeline I got so far but it just makes the movieclip follow the mouse;
Code:
ship_mc.onEnterFrame = function() {
var xMouse = _root._xmouse;
[code].....
View 2 Replies
Oct 18, 2005
I want to create a sidescroller game in which the characters arm rotates according to the mouse position(for aiming). I am no stranger to flash, I've been using it for years.
View 2 Replies
Feb 5, 2010
I'm using a carousel script that rotates some images, the speed of the rotation depends on where the mouse is on the screen. The project I put it into is 962 pixels wide, the carousel itself is about 400 pixels wide, I want it positioned on the right half of the project, so I put the code in a blank movie clip and positioned it on the right.
It works fine, but the problem is the rotation gets crazy fast as the mouse moves to the left side of the stage, because there's so much more space on the left then there is on the right. I only want for it to stop gaining speed when the mouse leaves the carousel area.
Code:
//We use 70x70 sized images (change this if different for your images)
const IMAGE_WIDTH:uint = 70;
const IMAGE_HEIGHT:uint = 70;
[code]....
View 6 Replies
Mar 12, 2012
I created a SWC which is a simple MovieClip that contains some TLF text fields. I have embedded the font using the Flash Professional IDE. When instance this Class in my main app
var myInstance:MovieClip = new SomeClass() as MovieClip
I get a Type Coercion error call:
Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@1fbcc271 to fl.text.TCMText.
View 1 Replies
Feb 26, 2009
I really need a Timer that shoots multiple functions. The Timer Class just handles one function and therefore is not good enough for my project. The Timer should work something like this:
After 1 seconds fire functionOne
After 4 seconds fire functionTwo
...and so on...
Time is really crucial in my project (down to milliseconds) so I really can't use the Timer Class and fire "new" Timers all the time because Flash needs some milliseconds to process all the code and in the end it sums up to kind of a lot of time.
View 7 Replies
Aug 28, 2010
Let's take the next example:
<mx:State name="sayHello">
<mx:SetProperty name="preText" target="{this}" value="Hello"><mx:SetProperty>
</mx:State>
Can I somehow know when preText property has been set to hello?
[Code]...
View 1 Replies
Nov 7, 2011
In my side-scrolling game, I am trying to create blow darts which the player shoots. Of course, I want the darts to start where the Player is and then the darts move in their directions.
However, I have a problem. In my game I use a scrolling function that places the player right in the middle of the screen. Here is that function:
[Code]...
View 1 Replies
Mar 14, 2006
I'm working on a simple first person game - converting it to a banner ad.I'd like the timeline to move to an end game frame after 5 shoots or after 20 seconds -how the script below controlling the game can be modigied to achieve this?
Code:
var i;
// gunfire sounds
[code].....
View 1 Replies
Apr 2, 2007
I have like a bullet shooting thing which shoots bullets (obviously), and it sorta rotates around a point and fires at a movie clip. At the moment the bullets move outwards because of a animation in side the bullet movie clip, but how can I make them move outwards and away from the thing that fired them using actionscript?
View 8 Replies
Feb 4, 2010
I want to make a basket ball. Drag on the ball release it and its shoots far depending on how far you drag it back.. Anyone have a quick code to share?
View 8 Replies
Mar 17, 2011
Okay I've gone through a good hundred posts on this site and some others but I can't seem to find what I want (Or I just simply don't understand the code.)First thing first. I have no idea how to code what so ever. I just copy and paste stuff into other stuff and hope it works.Objective; Birdseye view perspectiveOkay so I have this background layer, in that background layer is a "Table top spinner" which I've set as a movie clip. What i'm trying to achieve is when you click the movie clip it will trigger a simple animation (spinner on it's side into spinner upright) You are then able to drag the spinner in a set space on the stage (Table) Whilst you are dragging it the spinner will rotate (I've tried animating a rotation but it just looks clunky) and when you release the drag the spinner will start to slow down and come to a stop triggering another animation which will revert it back to it's side
View 0 Replies
Aug 3, 2009
First, this has to be done in AS2 to load into a previously existing shell, so I can't use AS3 or Papervision.
I am using Lee Brimelow's carousel, but I need to change the operation so the individual carousel element only rotates to the front when clicked.
Kind of like this but less fancy (just the rotation part):
[URL]
I know it requires some kind of calculation of the endpoint of the spin, but I keep running into odd results.
View 3 Replies
Aug 3, 2009
If I can see how this would be done in AS3, I can translate the logic to AS2. I am using Lee Brimelow's carousel(AS2-attached), but I need to change the operation so the individual carousel element only rotates to the front when clicked.[URL]I know it requires some kind of calculation of the endpoint of the spin, but I keep running into odd results.This has to be done in AS2 to load into a previously existing shell, so I can't use AS3 or Papervision.
View 0 Replies
Nov 6, 2010
fla
mediafire.com/?fk1i54pwyucwk5i#1
swf
mediafire.com/?stqi83y61vzwf6c
View 8 Replies
Oct 26, 2004
i'm working on a flash game at the moment, and i would like to know if i am able to set the point that the movieclip rotates around using actionscript. i don't want to do it by simply moving all of the contents of the movieclip closer or nearer. is there any other way of doing it? i couldn't find any simple functions for it. am i just going to have to use some complicated maths?
View 3 Replies
Dec 11, 2008
I am playing with carousel 3 file and I have found it very simple to tweak the AS to fit my needs. However I would like to change the alpha to tween to say 60% when the icon is in its rear most position.
View 3 Replies
Apr 7, 2005
i want to make this menu which a part of it rotates. I have a circle with text besides it. This are the buttons. On this circle i have some kinda thing which points the button of where the users mouse is on. So each time the users chooses anothe button, the pointer has to rotate to that button. If there is no mouseover or anything, the pointer has to point the button on where the user is on the site (so in home the point has to point to home button)
View 13 Replies
Apr 6, 2010
I am making some animations with shape tweening. I actually need it for my presentation.There are five layers of almost same shape of objects. The first two layers and shape tweening works as I expected.But from third layer, something weird happening. As I do shape tween, the layer becomes two moving objects: one is acting as I wish, but the other same object rotaing in x-direction.
View 1 Replies
Oct 6, 2010
I am working on a car game in flash where you see the car from a top view and you go straight ahead all the time on an endless road.The game so far is built in the way that I have a image of a car that's the main car and the road is a image itself that keep switching with another image of the road and when you play it it looks like the car is moving very fast. But actually the car is not moving at all except for when you move it yourself by going right or left.When turning right I do not want the car to simply move to the right, but I also want it to rotate a bit so it looks more realistic when turning.So when you press the right key it rotates 5 degrees even if you keep holding it and when you release the button it rotates back quickly.The script I'm using:
onClipEvent(enterFrame) //This
{
if(Key.isDown(Key.LEFT))[code].....
View 2 Replies
Jul 23, 2009
still progressing with the rotating menu, I am trying change the values so that I can position correctly but I can't seem to tweak it? as the menu rotates the other images resize and get smaller, I think its somewhere within the script that is doing this, I would like it not to resize as it rotates away from center. but I can't seem to find what is making it do this? is this making any sense, i have been changing these values, but not quite working; values I have been looking at on the circleMenu.as at line 38
[Code]...
View 29 Replies
Apr 21, 2010
At the moment i am trying to make a flash banner that rotates banners out randomly and also when the guest sees the a banner they are intrested in they can click on it and it will take them to the respective link. I followed some tutorials out there on how to use xml and flash together and came up with this for my flash code:
// set random # variables - each must be 0 for first 'while' loop belowvar randomNum = 0;var randomNumLast = 0;
// parent containervar container_mc = this.createEmptyMovieClip("container",0);// movie clip
[Code].....
View 10 Replies
Aug 14, 2010
I've got a symbol that's circular, and I'm trying to make it rotate. My problem is that everytime I rotate it (45 degrees per frame), the dimensions change slightly on me. It's a circle with a height and width of 364 pixels. After rotating it clockwise 45 degrees, the new dimensions are 386.9 by 397.4. The result is a slight pulsing as the symbol rotates when the animtaion plays. I can't figure out what's happening, and it's SUPER frustrating.
View 5 Replies
Dec 17, 2007
I have a swf that loads external images from an xml feed (using moviecliploader) and then rotates through these images every n seconds. This works fine in ie and it loads the images and scrolls through them. However in Firefox sometimes it loads the image and sometimes it doesn't! its like a lucky dip haha Is there any link that you know of to any information on this bug/issue with firefox that might help me resolve this? Found something that might be causing the problem, if Firefox cannot find the image within a certain time it just gives up... is this true?
View 1 Replies
Apr 29, 2009
I am working on a gallery: the slider rotates the container with the images using Tweener class and easeOutCubic transition. There are 45+ images around the center of the container The movement is not smooth, especially when comparing to the way it would be with a small container. Also, and most important - A rough "snap" appears randomly in the end of the motion.
[Code]...
View 3 Replies
Mar 22, 2007
I am using Fuse to rotate a movieclip in a navigation system. The problem is, it flips out and rotates a full circle before getting to the final destination when the destination is higher than 180. I can't figure out why. Here is the code:
[Code]....
View 2 Replies