User Tag List

Results 1 to 6 of 6

Thread: Extra Enemy Attacks

  1. #1
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,304
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.8%

    Extra Enemy Attacks

    Had enough of the old 'rock and sword' projectiles?

    Wellll....


    Now we have homing laser and flamethrower =D
    I've tried to make them as fool-proof as possible, so basically all you have to do is stick them into a script file with std.zh in it, then put them on a screen with an enemy on.
    And set the graphics for the fireball in the flamethrower.


    So:
    Enemy Flamethrower
    Code:
    ffc script flamethrower{
    	void run(int t,int c,int d,int n,int f,int a){
    	if(a==0) a=1;
    	if(d==0) d=4;
    	Waitframes(4);
    	npc e = Screen->LoadNPC(a);
    		while(e->isValid()){
    			homingprojectile(e->X,e->Y,t,c,d,2,n,f);
    		Waitframe();
    		}
    	}
    	void homingprojectile(int x, int y, int tile, int cset, int dmg, int spd, int num, int fspd){
    	 eweapon w = Screen->CreateEWeapon(31);
    	 w->Tile = tile; w->OriginalTile = tile;
    	 w->CSet = cset;
    	 w->NumFrames = num; w->ASpeed = fspd;
    	 w->X = x; w->Y = y;
    	 w->Step = spd;
    	 w->Damage = dmg;
    	 w->Angular = true;
    	 int angle = ArcTan((Link->X-x),(Link->Y-y));
    	 w->Angle = angle;
    	 if(angle==-PI || angle==PI) w->Dir=2;
    	 else if(angle==-PI/2) w->Dir=0;
    	 else if(angle==PI/2) w->Dir=1;
    	 else if(angle==0) w->Dir=3;
    	 else if(angle<-PI/2) w->Dir=4;
    	 else if(angle<0) w->Dir=5;
    	 else if(angle>(PI/2)) w->Dir=6;
    	 else w->Dir=7;
    	}
    }
    D0: Tile for projectile to use
    D1: CSet
    D2: Damage (default 1 heart)
    D3: Number of frames of animation of projectile
    D4: Speed of animation
    D5: Number of enemy on screen to put flamethrower attack onto (default 1)


    Enemy Laser
    Code:
    ffc script laser{
    	void run(int d,int w,int a){
    	int dx; int dy;
    	int m; int c;
    	int i; int j;
    	if(a==0) a=1;
    	if(d==0) d=4;
    	if(w==0) w = 4;
    
    	//this is the number of frames behind Link the laser is. Because we don't have variable arrays, if you want
    	//to change it, you have to change all 3 numbers here. Make them the same. Please.
    	int fb = 20;
    	int x[20]; int y[20];
    
    	x[0] = Link->X+8;
    	x[0] = Link->Y+8;
    	for(j=0;j<fb-1;j++){
    		for(i=fb-1;i>0;i--){
    			x[i] = x[i-1];
    			y[i] = y[i-1];
    		}
    	Waitframe();
    	}
    
    	npc e = Screen->LoadNPC(a);
    	j = 0;
    		while(e->isValid()){
    		if(j>0) j--;
    			x[0] = Link->X+8;
    			y[0] = Link->Y+8;
    			for(i=fb-1;i>0;i--){
    				x[i] = x[i-1];
    				y[i] = y[i-1];
    			}
    
    			dx = (e->X+8)-x[fb-1];
    			dy = (e->Y+8)-y[fb-1];
    			if(dx != 0){
    				m = dy/dx;
    				c = y[fb-1] - m*x[fb-1];
    				if(dy==0){
    					y[fb] = y[fb-1];
    					if(dx>0) x[fb] = 0;
    					else x[fb] = 256;
    				}else if(dy>0){
    					y[fb] = 0;
    					x[fb] = (y[fb]-c)/m;
    				}else{
    					y[fb] = 256;
    					x[fb] = (y[fb]-c)/m;
    				}
    			}else{
    				x[fb] = x[fb-1];
    				if(dy>0) y[fb] = 0;
    				else y[fb] = 168;
    			}
    
    			Screen->Line(2,e->X+8,e->Y+8,x[fb],y[fb],Rand(120)+1,1,0,0,0,128);
    			if(j==0){
    				if(DistancePointToLine(e->X+8,e->Y+8,x[fb],y[fb],Link->X+8,Link->Y+8) < 2 && Link->Z == 0){
    					Game->PlaySound(36);
    					Game->PlaySound(19);
    					Link->HP -= d;
    				}
    			j = w;
    			}
    		Waitframe();
    		}
    	}
    	int DistancePointToLine(int x1,int y1,int x2,int y2,int distx,int disty){
    	 int dx = x2-x1;
    	 if(dx != 0){
    		int m = (y2-y1)/dx;
    	  int c = y1 - m*x1;
    	  return (Abs(-m*distx + disty - c))/Sqrt(m*m + 1);
    	 }
    	 else return Abs(distx-x1);
    	}
    }
    D0: Damage of laser (default quarter heart)
    D1: Number of frames to wait between taking damage from laser (default 4)
    D2: Number of enemy on screen to give laser attack to (default 1)

    If you want to edit how many 'frames ago' it attacks, then I've noted up the places you have to change in the script.

  2. #2
    Gibdo Master Maniac's Avatar
    Join Date
    Aug 2007
    Location
    umm in a house
    Age
    32
    Posts
    646
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,533
    Level
    16
    vBActivity - Bars
    Lv. Percent
    47.22%

    Re: Extra Enemy Attacks

    joe, this is perfect for scripting beamos statues! awesome =) you are truly a scrpting genious.
    ... i just died a little inside...

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    "this time, of this sixteenth of a thousand lives will be my last, and this curse will be broken. though my fate is to burn in hell, it is worse to live among the thousand lifetimes that i have been sentenced to, than it would be to have satan tear the flesh from my body repeatedly for an eternity"

    --Andross Maximillion Remedy
    (otherwise known as Rem)

  3. #3
    Wizrobe
    Join Date
    Dec 2006
    Age
    29
    Posts
    3,693
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    8,936
    Level
    28
    vBActivity - Bars
    Lv. Percent
    43.02%

    Re: Extra Enemy Attacks

    I will definitely use these for Beamoses! Thank's Joe!
    Quote Originally Posted by rock_nog View Post
    Well of course eveything's closed for Easter - don't you know of the great Easter tradition of people barricading themselves up to protect themselves from the return of Zombie Christ?


  4. #4
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,304
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.8%

    Re: Extra Enemy Attacks

    Hrm.

    It's a bit powerful to be a Beamos really.
    I might make a Beamos though, that rotates and only shoots if Link is near that direction or something.
    I'll see.

  5. #5
    Wizrobe
    Join Date
    Dec 2006
    Age
    29
    Posts
    3,693
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    8,936
    Level
    28
    vBActivity - Bars
    Lv. Percent
    43.02%

    Re: Extra Enemy Attacks

    You might? Awesome! Although to be honest, I'd rather see you try to finish the DoFR Scent tree that make a beamos script. :)
    Quote Originally Posted by rock_nog View Post
    Well of course eveything's closed for Easter - don't you know of the great Easter tradition of people barricading themselves up to protect themselves from the return of Zombie Christ?


  6. #6
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,304
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.8%

    Re: Extra Enemy Attacks

    Woahhh, that was ages ago, I competely forgot about that =P

    I might go back to it sometime, but I really wasn't finding it too easy at all.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social