View Single Post
  #1  
Old 06-07-2006, 11:26 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Arrays, images, and loops -_-

Okay, so I finally have some time to start working on a little game. My problem so far: The ship doesn't show, the comet fragments all show up in the corner of the screen (and as far as I can tell, there's only one of them). I've been staring at this for a while, I can't figure out why it won't work. Help?
PHP Code:
//#CLIENTSIDE
function onKeypressed()
{
if(
strequals(#p(1),D) && strequals(#w,Comet))
{
  if(
this.inuse_comet==0)
  {
    
this.inuse_comet=1;
    
this.screenx_comet=client.compscrnx+2;
    
this.screeny_comet=client.compscrny+2;
    
this.maxscreenx_comet=client.compscrnx+588;
    
this.maxscreeny_comet=client.compscrny+350;
    
this.comet_shipx=this.screenx_comet+294;
    
this.comet_shipy=this.screeny_comet+350;
    
this.level_comet=1;
    
this.levelup_comet=1;
    
settimer(.05);
  }
  else if(
this.inuse_comet==1)
  {
    
this.inuse_comet=0;
    
settimer(0);
    for(
this.i=500this.i<600this.i++)
    {
      
hideimg(this.i);
    }
  }
}
}
function 
onTimeout()
{
  
showimg 500,dr-comet_ship.png,this.comet_shipx,this.comet_shipy;
  
changeimgvis 500,20;
  
freezeplayer .05;
  if(
this.levelup_comet==1)
  {
    for(
this.i=0this.i<this.level_comet*10+3this.i++)
    {
      
this.cometx[this.i]=random(this.screenx_comet,this.maxscreenx_comet-5);
      
this.comety[this.i]=this.screeny_comet+2;
      
this.cometd[this.i]=random(0,3);
    if(
this.cometd[this.i]<1.5)
      {
         
showimg 501+this.i,dr-comet_smallrock.png,this.cometx[this.i],this.comety[this.i];
         
changeimgvis 501+this.i,21;
         
this.comet_img[this.i]="dr-comet_smallrock.png";
         
this.comet_width=20;
      }
    else
      {
        
showimg 501+this.i,dr-comet_bigrock.png,this.cometx[this.i],this.comety[this.i];  
        
changeimgvis 501+this.i,21;
        
this.comet_img[this.i]="dr-comet_bigrock.png";
        
this.comet_width=35;
      }
    }
    
this.levelup_comet=0;
  }
  
//rock movement
  
for(this.i=0this.i<this.level_comet*10+3this.i++)
  {
    
this.comety[this.i]-=.3;
    
showimg 500+this.i,this.comet_img[this.i],this.cometx[this.i],this.comety[this.i];
  }
  
//playermovement
  
if(keydown(1))
  {
    
this.comet_shipx-=.55;
  }
  if(
keydown(3))
  {
    
this.comet_shipx+=.55;
  }
  
  
settimer(.05);

Reply With Quote