ActionScript 2.0 :: Movable Turret Firing Duplicated Bullets?
Aug 11, 2004
I know there's all these posts on how to use For... loops to hittest, but no matter how hard I try, they just don't work. So, after hours of hair tearing, paceing and starting a new game I've decided to bother you all for help.
My situation is that in the game I'm making, I have a movable turret firing duplicated bullets. I need to hittest them against a duplicated set of oncoming robots. I've tried using a for loop, but I just can't get it to work.
I've attached the .FLA, and I would be grateful if anyone could point out what I'm doing wrong (ignore the values for removing the clips and the random duplication; I had to shrink the stage size to make the file size smaller
View 3 Replies
Similar Posts:
Jun 18, 2007
I have written the code below which restricts the number of bullets fired, but each bullet fired travels at a different speed to the last and when another bullet is fired the previous one disappears from the screen. Please can anyone give any guidance ?
import flash.display.MovieClip;import flash.events.KeyboardEvent;import flash.events.Event;import flashx.textLayout.formats.BackgroundColor;
var speed:Number;speed = 10;var shootLimiter:Number=0;
[code]....
View 5 Replies
Jun 12, 2010
I'm trying to make a turret that points towards the cursor, but lags when the cursor is moved. I can get this to work, however I am running into problems when the cursor crosses from quadrant 4 to 3 (and vice versa). The problem is that the function I am using to control the turret's rotation rotates the turret around the opposite direction almost 360 degrees to get to the new position, instead of moving the few degrees it needs to.
View 3 Replies
Aug 20, 2009
i am trying to make a "double-barrel" firing cannon in AS3..below is a crappy drawing of what im trying to acheive...im having trouble making the two bullets come out where they should (1 on the left barrel, 1 on the right barrel). prior to this, i already successfully created a standard "one-barrel" turret that rotates depending on the mouse location and fires 1 bullet per shot.. what i'm trying to do now is (like i said above) to create a double-barrel turret that would fire 2 bullets per shot (1 on the gun1 and 1 on gun2)..below is the code i used for the single-barrel turret: on the timeline:
ActionScript Code:
stage.addEventListener(Event.ENTER_FRAME, followMouse);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fireBullet);
var radians:Number;
[code]....
View 0 Replies
Mar 18, 2009
i am terrible at explaning things but i'm going to try my best.for example. I have a rotating turret that will follow the mouse 360 degrees.so i wonder if it is possible to go inside the turret ("mc") and stop at frame (2);when the turret reaches 170 degrees.
View 2 Replies
Oct 11, 2011
I have a Spaceship movieclip, with a movieclip Turret inside. Spaceship extends the Unit class, where I want to rotate the Turret. In my Spaceship constructor, I use super(this.turret); but this always returns null. Passing other variables works, and before calling super(), I can successfully trace this.turret So why can't I pass it to super? And how can I fix this? [edit] Perhaps it has something to do with the turret not being available/added to stage yet when super() is called? If so, how could I deal with that and get it "Unit" anyways?
View 1 Replies
Aug 11, 2009
i recently learned how to program a tank-type game.. i was able to make the turret follow the mouse and fire bullets that would move to the direction the turret was pointed at..what i'm trying to do now though is make the bullet follow an object moving on stage.. sort of like a heat-seeking missile..
View 2 Replies
Oct 22, 2010
I'm trying to create a movieclip that contains 6 different images. In this movieclip, I would like, for example, a mask that follows the mouse to reveal the next picture. (ex: Image 1 has a circle mask revealing Image 2. When clicked, Image 2 will now be at the front with a circle mask revealing Image 3. And then Image 6 will not have any mask but on click will go back to the beginning)I understand that a lot of it will be up to how I order them in the timeline and frames.My problem is that in my class, we've learned how to do this for TWO images only, and the only way for the mask to move is to use the MOUSE_DOWN and MOUSE_UP events (which is where the mask is only movable if you move it yourself.)It would be a big help if someone can first answer these questions:
1)What is the function called/is for instead of a MOUSE_DOWN/UP it will just simply follow the mouse?
2)Would I have to create 6 frames with, let's say, Image1 and Image2 on Frame 1, then Image2 and Image3 on Frame 2 etc? And each frame will have its own actions layer frame?
View 2 Replies
Nov 25, 2010
Basically I want to have a scrollable map ie. you can grab it with your mouse and move it. Exactly the way google maps works (although I'm not terribly concerned about the inertia effect that google maps has). But I also want to have objects on the map, that when the map is moved, they also move, but I can grab them individually also, and move the objects. Obviously when I nest these objects in the background symbol, they lose their independence and therefore can't be moved separately from the map. And I've been having difficulty making the objects follow the map, while maintaining their own position (they just snap to the maps position).
View 2 Replies
Apr 7, 2011
Is there a pointer/tutorial on how create something similar to the following sites: [URL]
It appears that there are multiple layers that move at its own speed when rolling left or right.
View 3 Replies
May 18, 2009
I'm trying to get my movable button to stop activating. It's looping (up/over/down/hit).
loupe_mc.onPress=function() {
this.startDrag();
};
loupe_mc.onRelease=function() {
this.stopDrag();
};
View 3 Replies
Jul 23, 2011
I figured that Flash would be the best for the result I'm going for. I am making an Adobe Flash website and part of the website includes a box that is draggable and movable around the screen. So, to keep it simple, how can I make it movable?
View 1 Replies
Feb 3, 2011
Is it possible to have a movieclip loaded to the stage not movable, but after a certain amount of time you can click on it and drag it to where you want it to go, and if so how would you go about doing that?
View 1 Replies
Feb 25, 2009
I have a Large moveable object that can be clicked and dragged around the movie, but how can I make so that if I border off an area of the movie the objects movement is limited to those corners. So the top left of the object cannot be dragged further than the top left corner of the border and so on.
View 2 Replies
Feb 3, 2010
I need to make my the images in my website movable. I found this [URL] but I just need a simple and easy version.
View 3 Replies
Feb 3, 2010
I need to make my the images in my website movable. I found [URL].. but I just need a simple and easy version.
View 3 Replies
Mar 12, 2011
I recently came across a small business site that had a homepage with there logo and some basic nav in the center with the business logoBut there entire background had a moving flash background made up of photos in the shape of words, that when you moved your mouse to the left, the background would move to the right, up and it would go down and so on as if it followed your mouse but inverted.
View 3 Replies
May 2, 2010
I've been trying to figure this out for a while now and cannot get it to work. I have a movieclip that can be moved up, down, left and right with the arrow keys, and reflected/flipped using the arrow and control keys together. However, I want to be able to use the arrow keys and shift to rotate the movieclip about a point with x co-ordinate 230 and y co-ordinate 180, regardless as to whether or not the movie clip has been moved up, left, etc.I've tried several different codes based on examples I've found online, but none have worked. I cannot make sure the centre point of rotation never changes.
View 0 Replies
Oct 13, 2004
I've made a site with small draggable "popup" windows (not actual windows since they are objects in flash..) I can drag em off the scene outside the edge. I've attempted many things.. A adaptation of the collision script found through search.. (on collision it stopped dragging) Worked nice, until you move the mouse real fast, then it can pass right through or partly through and the fact that it's stopdrag. It takes effort to get it from the edge. It's stuck basically.
I fixed it by making the on (press) change frame in a moveclip containing the border.. had a side effect though.. You can now drag the window out from the scene if you repetitively drag it towards the edge. Is there a way to limit a movieclips possible X & Y positions? (in both + & - range to make it a 4 cornered block). I also want the moveclip to keep moving up/down if if hits the right/left edge if you continue dragging it up/down (same with left/right edge also)
I tried the scrip from the "dynamic mask":
onClipEvent (enterFrame) {
getlimits = _root.normalpic.getBounds(_root);
if (_root._xmouse>=getlimits.xMin && _root._xmouse<=getlimits.xMax && root._ymouse>=getlimits.yMin && _root._ymouse<=getlimits.yMax) {
this._x = _root._xmouse;
this._y = _root._ymouse;
}}
I changed the size of the "normal pic" and it works lovely.. but it's on enterFrame... and I need to react on on press and on release.. : tried to adapt it but cant figure out how.. and besides the script don't allow movement along the edges (like I described above) and if you move the mouse fast enough the window stops short of the edge..
View 5 Replies
Oct 26, 2011
How can i make a MovieClip object drag able by the mouse? If i have two MovieClip instances, is it possible to make a new shape/MovieClip objects in that looks like a line and which will connect then? I have functions checking if the 'nodes' movie clip instances collide with the 'line' movie clip instances, now these all are different functions and conditional, but is it possible to check if ALL of them are true?
View 2 Replies
Mar 8, 2010
how to create bullets in as3? I have a main character = hero.mc Basically I need to store the bullets in an array and have them firing from the hero. It sounds simple enough, but for some reason I can't get it to work.
So far I have this:
Quote:
private var bullets:Array;
public function createBullets() {
bullets = new Array();
[code]....
View 15 Replies
Jun 28, 2011
I need a code in AS2 that launches a bullet ("bullet") from the character ("hero") towards wherever you clicked the mouse.For example, if I click somewhere, I want the bullet to launch straight towards where I clicked.
View 10 Replies
Jan 11, 2007
How do I add a bullet to Flash text? I know that alt0149 isthe html code. In the Flash text box and before the first textcharacter, I tried pressing the ALT key and simultaneously typingin 0149. Nothing happened.A similar question was asked on this forum... the answer wago to the Character Map (where is that) or use dynamic text (Itried putting alt0149 in the dynamic text box ??? but it didn'tork).My work-around so far is to copy a similar bullet and add itto the text box. But there must be a quicker way.
View 7 Replies
Mar 4, 2012
this is in my bullet movie clip on the timeline.[code]It all works but when i turn around it still shoots the same way im sure its something simple but i just cant work it out.
View 7 Replies
Jul 27, 2011
Is it possible to add bullets to a Label in Flex 4.5 mobile development?something like this:
.Item
.Item
.Item
View 3 Replies
Apr 25, 2011
is there any way to add bullets to a text?(ul or li are not working..)
View 1 Replies
Mar 19, 2005
I've got a mouse controlled person who fires circle bullets up towards oncoming enemies. but since i duplicated them, only the first bullet fired works as it is the only one that has the right instance name.What I mean is :The bullet is instanced bullet When it is duplicated to be fired, it changes to bullet1,bullet2 ect etc The hittest script on the enemies only reconize bullet, and therefore ignores all other shots except the first is there anyway of making it so it reconises all shots?
View 1 Replies
Jan 4, 2008
According to the search there's never been a post that contains the word "tabstops" in the history of . I am honored to be the FIRST!Anyway, I am converting an application so that text content that was once trapped in the authoring environment will now reside in an external XML file.The problem i'm running into is that my "textformat tabstops" tags and bullets no longer work.In the content I had:
Code:
<textformat tabstops='[10]'><br><br><b><u>Blah blah blah</u></b><br> Blah blah blah<br> lah blah blah etc.</textformat>
[code]....
View 2 Replies
Feb 6, 2009
I have finally got the movieclip to show up when i hit the ctrl key. but it just sits there because i have not yet added a speed. what would be the simplest way of doing this? what i want to move is a bullet.
View 2 Replies
May 7, 2009
I could create a movie clip for a bullet and create a new instance of one every time a bullet is fired. Then, I could have 100 little bullets all flying around checking collision detection...
There must be a better, more efficient way to do bullets. Anyone know of anything already out there?Otherwise, I could create a collision detection queue for the bullets, or predict where the bullet will fly (since it is usually always linear), but if the bullets become larger, the actual movie clip of the bullet may be wide enough to hit something, but the line the bullet is traveling does not necessarily hit that other object.
But is there a fast, efficient system or way of handling things already out there?
View 2 Replies