dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Making a scrolling shooter, can't figure out glitch!

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    2

    Making a scrolling shooter, can't figure out glitch!

    Okay, so I've got a pretty simple scrolling shooter going on, I started working on it in a CS3 class I was taking and at the very end of the course I ran into this problem and haven't been able to figure it out on my own! I know exactly what the error is, but I have absolutely no idea what's causing it or why, and it happens completely randomly. Sometimes I can play the game for 10 minutes and it'll work perfectly, sometimes I can play it for 10 seconds and then it will glitch and freak out. I'd like to try and explain it here more, but I feel as if it would be much easier for you to just run the game and see it for yourself.

    I've attached the .fla, I hope someone here can figure out what's going on! I apologize if my code is rather messy, as it should be obvious I'm still a Flash and AS3 noob and my formating habits probably aren't up to standard.
    Attached Files Attached Files

  2. #2
    Junior Member
    Join Date
    Jul 2009
    Posts
    2
    Here's a slightly updated version, I do not understand how I can be getting this error now.

    The error is when the function tries to reference a null object in the moveEnemy script, but here is the moveEnemy script:

    Code:
    function moveEnemy():void
    {
    	var enemyMove:Number;
    	for(enemyMove=0; enemyMove<enemies_arr.length; enemyMove++)
    	{
    		if(enemies_arr[enemyMove]!=null)
    		{
    			//if(enemies_arr[enemyMove].y<900)
    			//{
    			enemies_arr[enemyMove].y+=enemySpeed;
    			//enemies_arr[enemyMove].x+=enemyXVelocity();
    			//}
    			if(enemies_arr[enemyMove].y==900 && enemies_arr[enemyMove].enemyShipBasic_ani.alpha==1)
    			{
    				playerHealth+=10;
    				killEnemy(enemyMove);
    				//enemies_arr[enemyMove].enemyShipBasic_ani.alpha=0;
    			}
    		}
    	}
    }
    Now, please tell me, how could it possibly be trying to reference a null object when it's checking if the object is null before continuing?
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center