Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-29-2007, 12:19 AM   #1
Registered User
Join Date: Nov 2007
Posts: 3
Default Help with Basic Shooter!

I am making a Sniping game with Flash MX 2004 and I am having two problems. The first is concerning reloading your rifle and the display of your ammo. I am trying to have it so that when you click and fire a bullet from the six on your screen, one will disappear and continue to the point when none are left and you must click shift to reload it. However sometimes the display of the bullets is wacky, sometimes the bullets don't disappear, sometimes you can still shoot when out of ammo, and more. It worked earlier but doesn't work anymore.

The second problem is that I want to have multiple enemies on stage that you can kill. I had code that when you clicked on the enemies they would fall down and die while the others remained unaffected, yet it doesn't work now either. I also don't know where the code for the soldiers as well as the code for the ammo goes. Does it go on the button, frame, etc.?

Here it is:

This code is on the button for the first soldier which is inside a separate movie clip of that soldier.
onRelease = function () {
if (_currentframe == 1 && _root.ammo.checkAmmo()) {

Here is the code for the ammo, it is on the first frame on the ammo layer.

bullets = [];
function up() {
if (bullets.length<6) {
n = "a"+random(10000);
duplicateMovieClip(original, n, this.getNextHighestDepth());
created = this[n];
created._x = bullets.length*20;
created._y = 20;
function down() {
if (bullets.length>0) {
function checkAmmo() {
return bullets.length>=0;
function reload() {
for (i=0; i<6; i++) {
original._visible = false;

obj = new Object();
obj.onKeyDown = function(){
if (Key.isDown(Key.SHIFT)){

At the moment one bullet is displayed instead of six, and it doesn't disappear upon shooting. The soldier doesn't respond at all upon shooting him either.

P.S. Am I working with Actionscript 2.0? I think I am, but I wanted to be sure. Btw, if you couldn't tell already I am not very good with Actionscript.

Thanks in advance,

newbieian is offline   Reply With Quote
Old 12-01-2007, 03:22 PM   #2
Registered User
Join Date: Nov 2007
Posts: 3

The ammo works now, but my enemies don't respond when shot no matter what. I am not sure if the new ammo code somehow affects it. Can I email someone my flash and they look at it or could someone atleast give me the code necessary for the enemies?
newbieian is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extending a basic framework for specific needs. Flash Gordon Best Practices 2 09-17-2007 12:13 AM
Flash MX or any other VER. Basic Skills??? Jose Antonio Other Flash General Questions 2 04-10-2007 08:56 AM
basic PHP prob ?? vosgien Server-Side Scripting 11 08-14-2004 03:23 AM
basic "domino script" needed spyny Simple Stuff (Newbies) 8 01-26-2004 03:28 AM
A few really basic questions about Flash MX Denaes Components 1 12-08-2003 03:25 AM

All times are GMT. The time now is 09:13 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.