ActionScript 3.0 :: Simple Vertical Plane Shooter - HitTestObject

Dec 6, 2009

I've been trying to work on this simple vertical plane shooter. I got as far as creating everything and am now on the step to check if my bullet hits an enemy plane or an enemy bullet hits my plane. Because the enemy planes are created dynamically, I am trying to counter that with assigning then names when created so that the bullet knows what to look for. My approach for this might be somewhat wrong though. As for the enemy bullet hitting my plane, I just tell it to look for the instance of the plane already on the stage. Both result in the same error of undefined(the object can't be found).

Here is the code for both bullet collisions and the code for creating enemies.
ActionScript Code:
public function enemyHit(e:Event):void {
//declare i
var i:int;
//check if the bullet hit any enemy object
for(i = 1; i <= MovieClip(root).amount; i++) {
if(this.hitTestObject(enemy + i)) {
trace("enemy hit");
[Code] .....

The bullets have their own class files and the spawn enemy code is located within the fla file.

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Creating A Vertical Shooter Tutorial

Jan 24, 2011

I'm a bit of a newbie to this so I decided to follow this URL...The problem is that the dragons don't stop so I tried adding a time limit like this:[code]Frame 6 is my game over screen and the removeMovieClip works for the knight and the arrows but not for the dragons. They still carry on.

View 2 Replies

ActionScript 3.0 :: Creating A Vertical Scrolling Space Shooter Game For Deployment On Mobile Platforms Using AIR?

Oct 22, 2011

I am in the process of creating a vertical scrolling space shooter game for deployment on mobile platforms using AIR.I've used some excellent tutorials online, video tutorials on Lynda and several books, including Game Programming University.Something they all seem to gloss over are the various screens that will be used.

For instance, my game right now will use a splash screen, a main menu screen, a credits screen,a settings screen, a difficulties screen, an instruction screen, an end game screen and save/load screen...and a play game screen, where the actual game will be played.I've created the screens as seperate frames in the main timeline with stop commands in between and code on each page (I know... bad!... but easy).So basically,they can navigate through the menus using buttons (mouseclicks, which will work with touchs as well) and when they are How do I pass data between them? I was thinking of storing it in shared object.

View 1 Replies

ActionScript 3.0 :: Vertical Shooter Game On Kirupa Site - Code Error Of If SpriteX -= Steps;?

Dec 21, 2011

I'm trying to work through the Vertical Shooter Game within the tutorials section of this site:[URL]I noticed an code error of if spriteX -= steps; (which should have been += steps)However there are further errors within the tutorial as on page 3 where the man should be able to move and shoot his arrows, mine just shoots his arrows and has stopped moving. I'm using CS5 ActionScript3 to do this tutorial.

//---- variables ----
var steps:Number = 5;
var spriteX:Number = 265;
var spriteY:Number = 265;

[code]....

View 2 Replies

ActionScript 2.0 :: Make Simple Vertical Drop Down?

Apr 3, 2011

I have a simple flash site here [URL] I need to make the products button show a drop down menu on rollOver that oversteps the items bellow it and contains 4 su bmenu items. Now I managed to hide the buttons bellow and show the new ones, but when I move the cursor away from the Products button the sub menu disappears. I want to know how to make the sub menu stay there until the cursor is moved away from it and not away from the Products button

View 1 Replies

ActionScript 2.0 :: Simple Vertical Shooting Game - Rebound Missile Always Spawns At Left Of The Stage?

Feb 6, 2011

Basically, I have a border(line) at the top of the stage so that whenever my ship's missile comes in contact with this line, it is removed and a rebound missile clip is attached.Here is the missile code:

Actionscript Code:[code].....The problem is that the rebound missile always spawns at left of the stage, not wherever the ship missile was removed.I'm not sure if I should attach the fla, action script files, swf etc. to the thread. Also, my flash version is CS5.

View 3 Replies

Flex :: Align Vertical Axis Zero For Multiple Vertical Axis Chart?

Mar 22, 2011

Based on this Adobe multiple axis chart example: [URL]

Then I changed some data values to negative and my axis became not aligned anymore.

how to align vertical axis? Is this another Adobe bug or there is some property that aligns axis?

<?xml version="1.0" encoding="utf-8"?>
<s:Application
minHeight="600"

[Code]...

View 1 Replies

Actionscript 2.0 :: Get Vertical Dynamic Text Block By Setting To Vertical And Then To Dynamic

Jun 17, 2009

i found i can get vertical dynamic text block by setting to vertical and then to dynamic. But, then it ends up being horizontal, and if inside a clip, only the letters over another item in clip show. Like veritcal text on a vertical bar gives only the 1 or 2 letters that fit across bar, rest truncated. i've tried embedding text to get this far, but still doesn't work 'all the way' i see online they talk about all scripting for dynamic, vertical text; is that necessary, or am i missing something??

View 1 Replies

ActionScript 3.0 :: Travel Along 3d Plane

Nov 10, 2010

Im trying to figure out how to travel along a plane to a point in 3d space. It needs to feel as though travelling down a road. I have attached a swf with the desired effect. Im using the formula scale = fl/(fl + z);the problem im having is it looks fine until scale is > 1. I need the plane to stay central to the screen.

View 0 Replies

ActionScript 2.0 :: Rotating A 2d Plane In 3d?

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

ActionScript 3.0 :: Add Image To A Plane?

Apr 15, 2011

how i can add text on a plane and put the plane in a 3d scene?

I have the following

Code:
[Embed(source="../lib/QuickScan.png")] private var QuickScan:Class;
private function createScene():void {
quickscan = new QuickScan();

[Code].....

View 2 Replies

[CS3] Score Counter In A Shooter Game

Nov 24, 2008

I have a simple shooting game set up. 25 monsters appear on the screen, one after another, until no monsters are left. If you hit one before it disappears, the score increases. If you don't, the score stays the same.

In the actions frame, I placed an empty dynamic text box named score, and set it equal to 0 (declared in the main actions frame). But, seeing as though the monster actions are coded into the library item itself, do I have to declare score, and the score increase there instead?

View 4 Replies

F8 :: Glitchy Arcade Shooter Game

Aug 15, 2009

I've only played around with a dressup and dating sim - and coding using actionscript (and coding in general, only done a little bit of VB and Python before). I've been following a nice arcade side-scroller tutorial on this site which has three parts, if you want to view and go over them to help. It was designed for Flash 5 and I'm using Flash 8 Pro.[code]Anyway, as I was going through and coding/drawing the whole thing I came across a lot of problems and glitches (and a lot of times when the game coding would crash and I'd have to abort it and remake the entire coding again). I sort of stumbled around blindly, deleting and editing code to get things to work, and I'm up to the point where I'm almost finished with the thing. It's still glitchy though.I was wondering if any Flash coders could help me out?I'm going to be creating a Flash game for my programming class and I would prefer if it wasn't screwy (if I need to remake it with less cutesy graphics). xD;; If you could download the .Fla file and fix the coding problems I have.

Playable SWF game on my deviantart account.FLA downloadable file (@ Mediafire; no viruses, trojans, blahblah attached)The enemies tend to randomly explode before the missile has even hit them.The original enemy movie clip doesn't even want to explode.The score counter won't tick for each kill.The boundary box (?) of the player/enemy seems to be too big. You die before you should - in certain positions the enemy gets close and I guess the boundary boxes hit, which initiates the hitTest. It seems premature though, I'm wondering if I can reduce the boundary box, or have it so the enemy and player collide on the actual graphic, and not the movie clip box? I have no idea if this makes sense, I hope it does.There seems to be a bunch of other small glitches too.

View 6 Replies

Memory Leak In My Shooter Game?

Oct 20, 2011

I'm very new to flash,and have been digging through google and this site for information on how to piece together an AS2 shooter game.Its going well enough, but I'm having slowdown issues the longer the games runs, and I was hoping someone here could point me in the right direction.To paste an enemy movie clip on the screen, i'm using this:

Code:
var spawn =_root.attachMovie("monster1","monster1"+_root.getNextHighestDepth(),_root.getNextHighestDepth())[code]........

I need them stored in an array so that the player's shots can test weather or not they've hit any monster on the bullet's enter frame function, then call that monster's movie clip's take damage function. I'm using a for loop to do this:

Code:
for(var i in _root.player.foes){
if (this.hitTest(_root.player.foes[i])){
_root.player.foes[i].takedamage();}
}

I think the problem with the slowdown is that each time I place an enemy on the screen the array gets bigger and bigger. The slowdown only happens while the player is shooting, and I suspect the ever longer for loop with the hit testing is causing it.

I'm already removing the monster's movie clips as they get killed or exit the screen, I guess what I need is a way to reduce the size of the array at the same time, or at least tell the for loop not to do a hit test unless the monster is still alive.

View 3 Replies

ActionScript 2.0 :: Making A Top-down Shooter Game?

Mar 17, 2004

I'm making a top-down shooter game. I have keyboard input that moves the ship around and fires a laser.everything works perfect except that when the ship moves diagonal up left, or diagonal down right, the laser can't fire at the same time. It will work in any other direction, including the other diagonals. Just not those two

[Code]...

is this a common problem among movement in games? or do I just need to fix something?

View 1 Replies

ActionScript 3.0 :: Calculate 3D Plane From 2D Projection

Jan 16, 2012

I'm basically trying to emulate Photoshop's Vanishing Point tool where you can define the 4 2D points and the 3D plane is calculated from that information, in terms of the rotation of the plane relative to x y and z axes.

So if you have an image like this one:
And you define the points of the four corners, maybe like this:

It would define the 3D plane that the surface must live on relative to the x y and z axes. Researching this has led me to some tutorials on drawTriangles and Homographies, but they all seem to be focused on mapping bitmap data and I can't seem to find anything that defines a 3D plane itself.

View 5 Replies

Flash :: Moving 2d Objects On A 3d Plane?

Jun 11, 2010

I have a 2d plane rotated on its x axis, with 2d display objects I want to move around on the plane. Its pretty similar to a chess board [URL]..

The board is a rotated rectangle, and the pieces are just 2d display objects. Whats the easiest way to manipulate those objects so they appear to be moving on the board?

View 1 Replies

ActionScript 3.0 :: Draw A Plane Between The Known Points?

Jun 22, 2010

I have an array of points and I need square planes to be drawn between these points and distorted if points change their coordinates (see what I mean in the attached file).So what is the best practice I should use to create such set of planes knowing just coordinates of the points (planes vertices)?

View 4 Replies

ActionScript 3.0 :: Papervision 3D Plane Flying?

Jul 22, 2011

I am having trouble getting a spaceship to fly through space in 3 dimensions. I was wondering if anyone knows of like some good example source code for 3D plane flying movement?

Or if someone could point me in the right direction for the Trigonometry equations,

View 0 Replies

ActionScript 3.0 :: Papervision 3d Spiral Plane?

Oct 13, 2011

Can I make Spiral Plane with Papervision3d using TweenMax or other tweener engine the like attached picture? Which plugin should I use if possible?

View 1 Replies

ActionScript 3.0 :: FLVPlayback Onto A Papervision Plane

Sep 15, 2009

I add an FLVPlayback component on to a Papervision Plan. So far so good. Video plays, 3d works. But I am facing two issues:

1. Even though I set my MovieMaterial to interactive, I canot click on the controls. I have found someone else that stumbled onto something similar (link 1, link 2), but since they did not have answer, I though of asking here.

2. The FLVPlayback is jittery. What I mean is that the component's x position moves all the time from something like 0 to 10 or 20, then back to zero. Remember in the old days of analog television (if you're old enough) when you had to play with the tracking? It looks like that.

Here is my code:

Code:
package
{
// + ----------------------------------------
// [ IMPORTS ]

[Code]....

View 2 Replies

ActionScript 3.0 :: Can't Access Plane To Ratate It?

Oct 25, 2009

Trying some tutorials about Papervision3d. Found a problem when trying to rotate the plane.the AS conde below:

Code:
package {
import flash.events.Event;

[code].....

View 1 Replies

ActionScript 3.0 :: Developing An Horizontal Shooter Game?

Jan 10, 2012

I just started developing an horizontal shooter game, but how can i make enemies ( movieclips ) moving randomly around the screen?

View 1 Replies

ActionScript 2.0 :: Virtual Shooter - Pause The Game?

Mar 14, 2008

I am playing around with the Vertical Shooter by Ernesto Quezada aka _Bruno

link on kirupa: http:[url]....

how can I pause the game.I added a button, but I need the right coding in AS2

View 1 Replies

ActionScript 2.0 :: Make An Overhead Shooter Game?.

May 18, 2011

Im attempting to make an overhead shooter game. Ive got the basic movement down already, and rotation towards mouse. For when he shoots, ive set it to duplicate a bullet movie clip, but i only understand how to set it towards one graphical direction(ex: x +, y -)

The code i know ive gotta fix is

onClipEvent (enterFrame) {
this._x += laserMoveSpeed;
if (this._x>1000) {
this.removeMovieClip();
}
}

The little x + part has to be fixed, but i have no idea what to substitute in order to make it shoot from the front.

View 3 Replies

ActionScript 2.0 :: How To Delay The Fire - Shooter Game

Nov 7, 2004

'm testing functions to make myself a First Player Shooter game and now I have problem with the fire delay. I want a limit of let's say 1 shot per second. I thought that maybe restricting the clickings counted, so it doesn't register the mouse clicks too close to eachother. Or put some kind of interval at the functions delaying the sound and event function, but that seems too hard.

The game so far:[URL]As u see one get multiple sounds when clicking a lot and it's possible to get several points by clicking the ball a lot.Also, when the ball goes behind the tree it's not supposed to be able to shoot. The Flash File: [URL]It's not the exact same, some junk code trying to make the delay...

View 14 Replies

ActionScript 2.0 :: Space Shooter - PowerUps And Level End

Oct 27, 2002

I'm trying to make a space shooter type game, and I followed a tutorial on flashkit, and I have all that done, but. How do you do powerups? And how can you make the level end? And how can you make a boss? How do you make a powerbar instead of just "Lives" going down when you get hit. I am also doing a FPS type game related to star fox.
*SCREEN SHOT*

View 11 Replies

ActionScript 2.0 :: StarFox Side Scrolling Shooter In MX

Oct 29, 2002

I'm working on a StarFox side-scrolling shooter in MX. I need instructions for the coding of the following features:

|Character Has Lives
|Arwing (ship) Takes Damage
- Explodes After All HP is Lost
|Arwing Cannot Leave the Screen
|Arwing Can Perform Special Moves
- A Barrel Roll That Will Deflect Enemy Lasers

|Game Timer
|Pause

|Power-Ups
- Regain HP
- More Weapons

|A Boss at the End of Each Level
- Boss Has a Health Meter
- Goes to Next Level After Boss is Defeated

View 7 Replies

ActionScript 3.0 :: Finding The Length Of A Plane Along The Z Axis

May 10, 2010

if I take a square, turn into a Movie Clip, addjust the Perspective Angle, and the Vanishing Points. Then I rotate the square along the x axis so that the square is now a plane laying on the z axis. How do I get the length of the Movie Clip? I need to know when a plane starts and ends on the z axis. I also need to get the width.

View 3 Replies

Professional :: Finding The Length Of A Plane Along The Z Axis?

May 10, 2010

if I take a square, turn into a Movie Clip, addjust the Perspective Angle, and the Vanishing Points.  Then I rotate the square along the x axis so that the square is now a plane laying on the z axis.  How do I get the length of the Movie Clip?  I need to know when a plane starts and ends on the z axis.  I also need to get the width.

View 13 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved