know what you might do for shooting?

Started by MisterN, April 16, 2011, 06:19:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

im confused on what to do for shooting? i think i might know what to do, but someone has to tell me if im on the right path. no im not asking for prebuilt code this time, just need to know.

I want to set up key X to shoot. I already put that part in. I also put in the sprite for the bullet. should I put just one or three (three at a time on screen) PlayerBullet(); ? Now what I got confused on the #1 thing (ill definitely need help with) is this: how can I spawn an object from the current coordinates from the Player (you know what I mean, like megaman firing his gun) and send that object in that direction (I know it could be done with game maker)(so standing right the object flys right, standing left it flys left). And finally how would I destroy that object when it runs into the blue, an enemy (in that case the enemy and the bullet would disappear), or goes off screen? Thanks
[code language="fenix"]
Program platform_engine; 
//these are global variables 
Global
 
    //initializes the player's sprites 
    int Player_graph[14];
 
    //initializes the enemy(s) sprites
    //letter of alphabet sorts out the enemies
    int enemy_x_graph[12];
 
   //initializes the collectibles sprites
   int pellet_graph[1];
   
   //initializes the levels images
   int level_graph[2];
 
    //initializes the levelmask
    int levelmask; 
 
//this sets up things like the games resolution and whatnot     
Begin 
    Set_mode(320,240,16); 
    Set_fps(20,0);   
 
    Map_clear(0,0,RGB(0,0,0)); 
    Write (0, 64, 16, 1, "Platform Game");

   //Starts the scroller
   scroller();
   
   //starts the levelmask (par on with the scroller, but is the mask for the levels)
   level_mask();
   
   //players fpg, and position
    Player(50,100);
 
   //enemy(s) fpg, and position
    EnemyX(260,100);
   
   //collectibles fpg, and position
   pellet(100,200);
   pellet(116,200);
   pellet(132,200);
   pellet(148,200);
 
    Loop 
        If (key(_esc)) 
        Exit("Bye",0); 
        End 
        Frame; 
    End 
End

//This process is for all the levels, menu's, and cutscenes
Process scroller()
Begin
   level_graph[0]=load_png(".\sprites\level\image\testlevel.png");
    level_graph[1]=load_png(".\sprites\player\Walk1.png");
   start_scroll(0,0,level_graph,0,0,0);//starts the scroll, variables:
   /*
   0: number of scroll, 0-9 are possible, this is the first one, so 0 :)
   0: fpg library you use, i only laoded 1 fpg, so it's 0 (the first library) in this case :)
   level: the map in the library chosen
   0: a background for the scroll you can choose (kind of second image scrolling
      with the same parameters, but not necessarily the same way, and in behind the previously
      selected image
   0:is the part of the screen the scroll is shown in, 0 is default region, the entire screen
      you can use this if you want to limit the size of the scrol (not in behind a menu or so)
      for performance issues i guess, thigns on the scroll also won't show outside the region.
      make sure you give your new regiona number other than 0 or it won't work ;)
   0:the flags:
      1:horizontal scroll of the map
      2:vertical scroll of the map
      4:horizontal scroll of the background
      8:vertical scroll of the background
      use: these are powers of two, it's like 4 bits,1=0001;2=0010,4=0100,8=1000
      add the together to get all the scrolls you cant, so 1+2=3 is the map scrolling both ways
      1+2+4=7 is map scrolling both ways, the background only scrolling horizontal
      1+8=9= the map scrolling hotizontal, the background scrolling vertical
      etc...
   */
       //sets the levels background images 
End

Process level_mask();
Begin
   levelmask=load_png(".\sprites\level\mask\testlevelmask.png");
End
 
//This process is for the player, all code that belongs to him is in this part 
Process Player(x,y) 
Private
    xspeed=3; 
    yspeed=0; 
 
    y_start_acceleration=4; 
    y_acceleration=0; 
 
    int fall; 
    int falling;    //indicate if character is in falling mode or not 
 
    jump=0; 
 
    int i; 
    int ii;         //you must say: counter to test every pixel of movement of hardness map 
    int pixel; 
    int red,blue,green; 
 
    int player_status; //0 is standing, 1 is walking, 2 is jumping, 3 is falling 
 
 
Begin
   //PlayerWalk Animations; it a good idea to repeat the same sprite 3 times so it doesn't 
    //look sped up unless you have many detailed frames, you can add as many as you want, just 
    //be sure to change int Player_graph[X] to the number of sprites you have (0 included, so 
    //its one number higher than the last Player_graph[X] you have 
    Player_graph[0]=load_png(".\sprites\player\Walk1.png");
    Player_graph[1]=load_png(".\sprites\player\Walk1.png");
    Player_graph[2]=load_png(".\sprites\player\Walk1.png");
    Player_graph[3]=load_png(".\sprites\player\Walk2.png");
    Player_graph[4]=load_png(".\sprites\player\Walk2.png");
    Player_graph[5]=load_png(".\sprites\player\Walk2.png");
    Player_graph[6]=load_png(".\sprites\player\Walk3.png");
    Player_graph[7]=load_png(".\sprites\player\Walk3.png");
    Player_graph[8]=load_png(".\sprites\player\Walk3.png");
    Player_graph[9]=load_png(".\sprites\player\Walk2.png");
    Player_graph[10]=load_png(".\sprites\player\Walk2.png");
    Player_graph[11]=load_png(".\sprites\player\Walk2.png");
    Player_graph[12]=load_png(".\sprites\player\Stand.png");
    Player_graph[13]=load_png(".\sprites\player\Jump.png");
    ctype=c_scroll; 
    Loop 
        //Player Movement 
        if (key (_left)) 
            flags = 1; 
            ii = 0; 
            while (ii <4) 
                pixel = map_get_pixel(0, levelmask, x-16, y);   
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<200) 
                    ii = 0; 
                    break; 
                else 
                    if (player_status!=2 and player_status!=3) player_status=1; end 
                end 
                ii = ii + 1; 
            end 
            x = x-ii; 
        end 
        if (key (_right)) 
            flags = 0; 
            ii = 0; 
            while (ii <4) 
                pixel = map_get_pixel(0, levelmask, x + 16, y); 
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<200) 
                    ii = 0; 
                    break; 
                else 
                    if (player_status!=2 and player_status!=3) player_status=1; end 
                end 
                ii = ii + 1; 
            end 
            x = x + ii; 
        end 
 
        if (!key(_left) and !key(_right) and player_status==1) 
            player_status=0; 
        end 
 
        // Jumping 
        if (key (_space)) 
            player_status=2; 
            falling=true; 
            pixel = map_get_pixel(0, levelmask, x, y +1 +15);   
            get_rgb (pixel, & red, & green, & blue);   
            if (blue<200) 
                fall =- 20;   
            end   
        end 
        // Implementation of fall.   
        ii = fall;   
        if(ii > 0)   
            while(ii != 0) 
                pixel=map_get_pixel(0, levelmask, x, y + (fall-ii) +15);
                get_rgb (pixel, & red, & green, & blue);   
                if (blue<201) 
                    ii = ii + 1; 
                    falling=false; 
                    break; 
                end 
                ii = ii - 1; 
            end   
        else   
            ii = 0; 
        end   
        // Move the fall until we can.   
        y = y + (fall-ii); 
 
        //Ending of jumping and falling status   
        if (player_status==2 and !key(_space)) player_status=3; end 
        if (player_status==3 and !falling) player_status=0; end 
 
 
        // Acceleration of gravity   
        if (ii == 0)   
            fall = fall + 3;   
            falling=true; 
        else   
            fall = 0; 
        end 
 
        //Player Status 
        //say(player_status); 
        switch (player_status) 
        case 0: graph=Player_graph[12]; end 
        case 1: 
            graph=Player_graph
            i=(i+1)%12; 
        end 
        case 2: graph=Player_graph[13]; end 
        case 3: graph=Player_graph[13]; end 
        end
 
        //say("frame"); 
        Frame;
      end
end
 
Process EnemyX (x,y) 
private 
int i;
int ii; 
int Xini;
int fall; 
int falling;
int pixel; 
int red,blue,green;
int inactive; 
begin
   //animations for the enemy
    enemy_x_graph[0]=load_png(".\sprites\enemies\x\x1.png");
    enemy_x_graph[1]=load_png(".\sprites\enemies\x\x1.png");
    enemy_x_graph[2]=load_png(".\sprites\enemies\x\x1.png");
    enemy_x_graph[3]=load_png(".\sprites\enemies\x\x2.png");
    enemy_x_graph[4]=load_png(".\sprites\enemies\x\x2.png");
    enemy_x_graph[5]=load_png(".\sprites\enemies\x\x2.png");
    enemy_x_graph[6]=load_png(".\sprites\enemies\x\x3.png");
    enemy_x_graph[7]=load_png(".\sprites\enemies\x\x3.png");
    enemy_x_graph[8]=load_png(".\sprites\enemies\x\x3.png");
    enemy_x_graph[9]=load_png(".\sprites\enemies\x\x2.png");
    enemy_x_graph[10]=load_png(".\sprites\enemies\x\x2.png");
    enemy_x_graph[11]=load_png(".\sprites\enemies\x\x2.png");
   Xini = x; 
   ctype = c_scroll; 
   loop 
      if(flags == 0) 
            ii = 0; 
            while (ii <3) 
                pixel = map_get_pixel(0, levelmask, x + 16, y); 
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<201) 
                    ii = 0;
                    flags = 1; 
                    break; 
                end 
                ii = ii + 1; 
            end 
            x = x + ii;   
      else
         if(flags == 1) 
            ii = 0; 
            while (ii <3) 
                pixel = map_get_pixel(0, levelmask, x-16, y); 
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<201) 
                    ii = 0;
                    flags = 0; 
                    break; 
                end 
                ii = ii + 1; 
            end 
            x = x-ii; 
        end
        end 
      i = i +1; 
      graph = enemy_x_graph [i%12];
      falling=true;
      if (inactive==0) 
            falling=true;   
        end 
        // Implementation of fall.   
        ii = fall;   
        if(ii > 0)   
            while(ii != 0) 
                pixel=map_get_pixel(0, levelmask, x, y + (fall-ii) +15); 
                get_rgb (pixel, & red, & green, & blue); 
                if (blue<201) 
                    ii = ii + 1; 
                    falling=false;   
                    break; 
                end 
                ii = ii - 1; 
            end   
        else   
            ii = 0; 
        end   
        // Move the fall until we can.   
        y = y + (fall-ii);   
 
        // Acceleration of gravity   
        if (ii == 0)   
            fall = fall + 3;   
            falling=true; 
        else   
            fall = 0; 
        end   
      frame; 
   end
end
 
process pellet(x,y)
begin
   //loads the fpg
   graph=load_png(".\sprites\collectibles\pellet.png");
   ctype=c_scroll;
   loop
      if(collision(type player))
         break;
      end
      frame;
   end
end  [/code]
werg

handsource-dyko

First, to get three bullets firing, you just call playerbullet() 3 times from your player process when the x key is pressed. You can use timers or the frame statement with a time duration like frame(1000) to adjust the time between the shots.

To spawn objects you can make use of some of the local variables from the player's process. To check whether the player is facing left of right you can acess the "flags" value.

To destroy objects, you can use signals when the collision occures, fist you'll let the bullet process kill the enemy instance it collides with (the collision function returns the identification code of the process that the caller process (the bullet process) collided with. You can now use that information as input for the kill signal.
Second, to make the bullet disappear, you'll put in some break statement in the bullet proces.

This is a conceptual example of how it could be done


PROCESS bullet(x,y,etc, etc);

PRIVATE

enemy_id;


etc
etc
etc

BEGIN

     LOOP
          IF (enemy_id=collision(TYPE enemy))

              signal(enemy_id,s_kill);
              BREAK; // ends the loop, thus killing the bullet instance itself
         END

      FRAME;

      END
END





Obviously there's a bit more to it to do this nicely,  but this is rougly the basic mechanism.
You have to be aware that when a kill signal is used, the program may crash when other processes attempt to acess this
particulair instaces of the enemy process. To prevent this from happening, you can use the exists() function to check if a
process instance (id code!) is still alive or not.

MisterN

so I have incorporated what you told me with no errors now I am at stage 2.
can I have a line of code that send the object flinging in that direction until it is deleted?
another one for its creation would be nice to. pressing x makes my character face left.
and can you explain the 3 at a time thing? i was confused a little bit
[code language="fenix"]
Program platform_engine;  
//these are global variables  
Global
 
   //initializes the player's sprites  
   int Player_graph[14];
 
   //initializes the enemy(s) sprites
   //letter of alphabet sorts out the enemies
   int enemy_x_graph[12];
 
   //initializes the collectibles sprites
   int pellet_graph[1];
   
   //initializes the levels images
   int level_graph[2];
 
   //initializes the levelmask
   int levelmask;  
 
//this sets up things like the games resolution and whatnot      
Begin  
   Set_mode(320,240,16);  
   Set_fps(20,0);  
 
   Map_clear(0,0,RGB(0,0,0));  
   Write (0, 64, 16, 1, "Platform Game");

   //Starts the scroller
   scroller();
   
   //starts the levelmask (par on with the scroller, but is the mask for the levels)
   level_mask();
   
   //players fpg, and position
   Player(50,100);
 
   //enemy(s) fpg, and position
   EnemyX(260,100);
   
   //collectibles fpg, and position
   pellet(100,200);
   pellet(116,200);
   pellet(132,200);
   pellet(148,200);
 
   Loop  
       If (key(_esc))  
       Exit("Bye",0);  
       End  
       Frame;  
   End  
End

//This process is for all the levels, menu's, and cutscenes
Process scroller()
Begin
   level_graph[0]=load_png(".\sprites\level\image\testlevel.png");
   level_graph[1]=load_png(".\sprites\player\Walk1.png");
   start_scroll(0,0,level_graph,0,0,0);//starts the scroll, variables:
   /*
   0: number of scroll, 0-9 are possible, this is the first one, so 0 :)
   0: fpg library you use, i only laoded 1 fpg, so it's 0 (the first library) in this case :)
   level: the map in the library chosen
   0: a background for the scroll you can choose (kind of second image scrolling
      with the same parameters, but not necessarily the same way, and in behind the previously
      selected image
   0:is the part of the screen the scroll is shown in, 0 is default region, the entire screen
      you can use this if you want to limit the size of the scrol (not in behind a menu or so)
      for performance issues i guess, thigns on the scroll also won't show outside the region.
      make sure you give your new regiona number other than 0 or it won't work ;)
   0:the flags:
      1:horizontal scroll of the map
      2:vertical scroll of the map
      4:horizontal scroll of the background
      8:vertical scroll of the background
      use: these are powers of two, it's like 4 bits,1=0001;2=0010,4=0100,8=1000
      add the together to get all the scrolls you cant, so 1+2=3 is the map scrolling both ways
      1+2+4=7 is map scrolling both ways, the background only scrolling horizontal
      1+8=9= the map scrolling hotizontal, the background scrolling vertical
      etc...
   */
       //sets the levels background images  
End

Process level_mask();
Begin
   levelmask=load_png(".\sprites\level\mask\testlevelmask.png");
End
 
//This process is for the player, all code that belongs to him is in this part  
Process Player(x,y)  
Private
   xspeed=3;  
   yspeed=0;  
 
   y_start_acceleration=4;  
   y_acceleration=0;  
 
   int fall;  
   int falling;    //indicate if character is in falling mode or not  
 
   jump=0;  
 
   int i;  
   int ii;         //you must say: counter to test every pixel of movement of hardness map  
   int pixel;  
   int red,blue,green;  
 
   int player_status; //0 is standing, 1 is walking, 2 is jumping, 3 is falling  
   
 
Begin
   //PlayerWalk Animations; it a good idea to repeat the same sprite 3 times so it doesn't  
   //look sped up unless you have many detailed frames, you can add as many as you want, just  
   //be sure to change int Player_graph[X] to the number of sprites you have (0 included, so  
   //its one number higher than the last Player_graph[X] you have  
   Player_graph[0]=load_png(".\sprites\player\Walk1.png");
   Player_graph[1]=load_png(".\sprites\player\Walk1.png");
   Player_graph[2]=load_png(".\sprites\player\Walk1.png");
   Player_graph[3]=load_png(".\sprites\player\Walk2.png");
   Player_graph[4]=load_png(".\sprites\player\Walk2.png");
   Player_graph[5]=load_png(".\sprites\player\Walk2.png");
   Player_graph[6]=load_png(".\sprites\player\Walk3.png");
   Player_graph[7]=load_png(".\sprites\player\Walk3.png");
   Player_graph[8]=load_png(".\sprites\player\Walk3.png");
   Player_graph[9]=load_png(".\sprites\player\Walk2.png");
   Player_graph[10]=load_png(".\sprites\player\Walk2.png");
   Player_graph[11]=load_png(".\sprites\player\Walk2.png");
   Player_graph[12]=load_png(".\sprites\player\Stand.png");
   Player_graph[13]=load_png(".\sprites\player\Jump.png");
   ctype=c_scroll;  
   Loop  
       //Player Movement  
       if (key (_left))  
           flags = 1;  
           ii = 0;  
           while (ii <4)  
               pixel = map_get_pixel(0, levelmask, x-16, y);  
               get_rgb (pixel, & red, & green, & blue);  
               if (blue<200)  
                   ii = 0;  
                   break;  
               else  
                   if (player_status!=2 and player_status!=3) player_status=1; end  
               end  
               ii = ii + 1;  
           end  
           x = x-ii;  
       end  
       if (key (_right))  
           flags = 0;  
           ii = 0;  
           while (ii <4)  
               pixel = map_get_pixel(0, levelmask, x + 16, y);  
               get_rgb (pixel, & red, & green, & blue);  
               if (blue<200)  
                   ii = 0;  
                   break;  
               else  
                   if (player_status!=2 and player_status!=3) player_status=1; end  
               end  
               ii = ii + 1;  
           end  
           x = x + ii;  
       end  
 
       if (!key(_left) and !key(_right) and player_status==1)  
           player_status=0;  
       end
      
      //Shooting
      if (key (_X))
         if flags = 0;
         end
         if flags = 1;
         end
      end
 
       // Jumping  
       if (key (_space))  
           player_status=2;  
           falling=true;  
           pixel = map_get_pixel(0, levelmask, x, y +1 +15);    
           get_rgb (pixel, & red, & green, & blue);    
           if (blue<200)  
               fall =- 20;    
           end    
       end  
       // Implementation of fall.    
       ii = fall;    
       if(ii > 0)    
           while(ii != 0)  
               pixel=map_get_pixel(0, levelmask, x, y + (fall-ii) +15);
               get_rgb (pixel, & red, & green, & blue);  
               if (blue<201)  
                   ii = ii + 1;  
                   falling=false;  
                   break;  
               end  
               ii = ii - 1;  
           end    
       else    
           ii = 0;  
       end    
       // Move the fall until we can.    
       y = y + (fall-ii);  
 
       //Ending of jumping and falling status  
       if (player_status==2 and !key(_space)) player_status=3; end  
       if (player_status==3 and !falling) player_status=0; end  
 
 
       // Acceleration of gravity    
       if (ii == 0)    
           fall = fall + 3;    
           falling=true;  
       else    
           fall = 0;  
       end  
 
       //Player Status  
       //say(player_status);  
       switch (player_status)  
       case 0: graph=Player_graph[12]; end  
       case 1:  
           graph=Player_graph;  
           i=(i+1)%12;  
       end  
       case 2: graph=Player_graph[13]; end  
       case 3: graph=Player_graph[13]; end  
       end
 
       //say("frame");  
       Frame;
      end
end

PROCESS playerbullet(x,y,etc, etc);

PRIVATE

enemy_id;

BEGIN

    LOOP
         IF (enemy_id=collision(TYPE EnemyX))
             signal(enemy_id,s_kill);
             BREAK; // ends the loop, thus killing the bullet instance itself
        END

     FRAME;

     END
END
 
Process EnemyX (x,y)  
private  
int i;
int ii;  
int Xini;
int fall;  
int falling;
int pixel;  
int red,blue,green;
int inactive;  
begin
   //animations for the enemy
   enemy_x_graph[0]=load_png(".\sprites\enemies\x\x1.png");
   enemy_x_graph[1]=load_png(".\sprites\enemies\x\x1.png");
   enemy_x_graph[2]=load_png(".\sprites\enemies\x\x1.png");
   enemy_x_graph[3]=load_png(".\sprites\enemies\x\x2.png");
   enemy_x_graph[4]=load_png(".\sprites\enemies\x\x2.png");
   enemy_x_graph[5]=load_png(".\sprites\enemies\x\x2.png");
   enemy_x_graph[6]=load_png(".\sprites\enemies\x\x3.png");
   enemy_x_graph[7]=load_png(".\sprites\enemies\x\x3.png");
   enemy_x_graph[8]=load_png(".\sprites\enemies\x\x3.png");
   enemy_x_graph[9]=load_png(".\sprites\enemies\x\x2.png");
   enemy_x_graph[10]=load_png(".\sprites\enemies\x\x2.png");
   enemy_x_graph[11]=load_png(".\sprites\enemies\x\x2.png");
   Xini = x;  
   ctype = c_scroll;  
   loop  
      if(flags == 0)  
           ii = 0;  
           while (ii <3)  
               pixel = map_get_pixel(0, levelmask, x + 16, y);  
               get_rgb (pixel, & red, & green, & blue);  
               if (blue<201)  
                   ii = 0;
                   flags = 1;  
                   break;  
               end  
               ii = ii + 1;  
           end  
           x = x + ii;  
      else
         if(flags == 1)  
           ii = 0;  
           while (ii <3)  
               pixel = map_get_pixel(0, levelmask, x-16, y);  
               get_rgb (pixel, & red, & green, & blue);  
               if (blue<201)  
                   ii = 0;
                   flags = 0;  
                   break;  
               end  
               ii = ii + 1;  
           end  
           x = x-ii;  
       end
       end  
      i = i +1;  
      graph = enemy_x_graph [i%12];
      falling=true;
      if (inactive==0)  
           falling=true;  
       end  
       // Implementation of fall.    
       ii = fall;    
       if(ii > 0)    
           while(ii != 0)  
               pixel=map_get_pixel(0, levelmask, x, y + (fall-ii) +15);  
               get_rgb (pixel, & red, & green, & blue);  
               if (blue<201)  
                   ii = ii + 1;  
                   falling=false;  
                   break;  
               end  
               ii = ii - 1;  
           end    
       else    
           ii = 0;  
       end    
       // Move the fall until we can.    
       y = y + (fall-ii);    
 
       // Acceleration of gravity    
       if (ii == 0)    
           fall = fall + 3;    
           falling=true;  
       else    
           fall = 0;  
       end  
      frame;  
   end
end
 
process pellet(x,y)
begin
   //loads the fpg
   graph=load_png(".\sprites\collectibles\pellet.png");
   ctype=c_scroll;
   loop
      if(collision(type player))
         break;
      end
      frame;
   end
end [/code]
werg

BlackCurtain

A little bit offtopic, but why do you have -5 karma?  ???

MisterN

werg

FreeYourMind

Amazing -7, you are in the hall of fame xDDDDD

handsource-dyko

can I have a line of code that send the object flinging in that direction until it is deleted? Do you mean a ricochet bullet when megaman fires a bullet and it ricochets when the bullet hit's the enemy? That's not so hard, when the collision occurs, have the bullet process check for a collision with an enemy type and at that point, animate it.

The third stage, do you refer to the use of signals? In that case, there should some examples of that in bennupack. Sooner or later you may stumble on it. When bennu crashes with a message that some instance (id-code) does not exist, you know you have something in your code trying to acces data from a process instance that has been killed, or wich code statements have been ended.

This code will end instantly:


PROCESS test();

BEGIN

END



It's instance will only exist for a wink of the eye. But this process will exist forever except when a kill signal is send to it.


PROCESS test();

BEGIN
      LOOP
            FRAME; // don't forget the frame statement, or the program execution will freeze.
      END
END



Bottom line, a process will need to have a internal loop in a lot of cases. As long as the statements within that loop are
executed, the process manager will treat the instance as a living/frozen or sleeping process (depending wheter a non distructive
signal was send to it), so other processes can detect it with a collision or an identfication code.




MisterN

that literally made no sense as to what i needed. i posted the code with the stuff in there. I just need to know how to make the bullets move now and when i pres x the character faces left.
werg

MisterN

Hellooooooo? anyone there? I swear the english part of this forum is practically dead.
werg

FreeYourMind

They on vacations dude :)
I take a look in a couple of days if nobody come here before xD

l1nk3rn3l

can be a health var....


        IF (enemy_id=collision(TYPE EnemyX))
              enemy_id.health -= 10;
              BREAK; // ends the loop, thus killing the bullet instance itself
         END


handsource-dyko

Also, enemy_id.health must be a local or public variable, otherwise it's treated as a private, so you won't be able to acess it from outside the enemy process itself. Declaring it as a local is the easiest way, when declared as a public var it's a little more tricky and requires the process to be decared. Please read this for more info: http://wiki.bennugd.org/index.php?title=Public_variable.

MisterN

i know alot of this but none of you are explaining why the character turns left when i shoot. seriously, download the .zip file.
werg

FreeYourMind

what this !??

//Shooting
      if (key (_X))
         if flags = 0;
         end
         if flags = 1;
         end
      end

this sentence compile and works ?!


another thing, don't do this:

Player_graph[6]=load_png(".\sprites\player\Walk3.png");
Player_graph[7]=load_png(".\sprites\player\Walk3.png");

you are repeting inecessary loads, use a fpg for the animations and asign the graph id at player_graph, or load the png's at the main program and asign an id for each one.

MisterN

i just went over converting everything to .fpg last month, it completely screwed over my game. so to me its fine.
and yes that compiles. but please, how can i fix that?
werg