User Tag List

Results 1 to 6 of 6

Thread: Mace Enemy

  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,303
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.7%

    Mace Enemy

    Code:
    const int T_CHAIN			= 196;		//Mace Chain
    const int T_HEAD			= 197;		//Mace Head
    //Gives an enemy a mace to swing at Link
    ffc script MaceEnemy{
    	void run(int num, int maxradius, int damage){
    	int counter = Rand(360);
    	int spintimer;
    	int radius = maxradius;
    	int x; int y;
    	int ret;
    		Waitframes(4);
    		npc e = Screen->LoadNPC(num);
    		while(e->isValid()){
    			spintimer = 0;
    			//spin the ball
    			while(spintimer < 240+Rand(120) && e->isValid()){
    				SpinBall(radius,counter,num,damage,false);
    				spintimer++;
    				counter = (counter+3)%360;
    			Waitframe();
    			}
    			//pull the ball in
    			while(radius > 20 && e->isValid()){
    				SpinBall(radius,counter,num,damage,false);
    				radius -= 2;
    				counter = (counter+3)%360;
    			Waitframe();
    			}
    			spintimer = 0;
    			//spin very fast with small radius
    			while(spintimer < 120 && e->isValid()){
    				SpinBall(radius,counter,num,damage,false);
    				spintimer++;
    				counter = (counter+10)%360;
    			Waitframe();
    			}
    			//throw at Link
    			x = Link->X;
    			y = Link->Y;
    			counter = 4;
    			ret = 1;
    			while(e->isValid() && counter > 0){
    				SpinBall(counter,ArcTan((x-e->X),(y-e->Y)),num,damage,true);
    				if(Abs(x-(e->X + RadianCos(ArcTan((x-e->X),(y-e->Y)))*counter)) < 4
    				&& Abs(y-(e->Y + RadianSin(ArcTan((x-e->X),(y-e->Y)))*counter)) < 4){
    					if(ret == 1) Pause(counter,ArcTan((x-e->X),(y-e->Y)),num,damage);
    					//return
    					ret = -1;
    				}
    				counter += 4*ret;
    			Waitframe();
    			}
    			Pause(0,0,num,damage);
    			//bring back to main spin position
    			counter = Floor(ArcTan((x-e->X),(y-e->Y))*180/PI);
    			radius = 0;
    			while(radius < maxradius && e->isValid()){
    				SpinBall(radius,counter,num,damage,false);
    				radius += 2;
    				counter = (counter+3)%360;
    			Waitframe();
    			}
    		}
    		Screen->ClearSprites(SL_EWPNS);
    	}
    	void Pause(int r, int c, int n, int d){
    		for(int i=0;i<10;i++){
    			SpinBall(r,c,n,d,true);
    		Waitframe();
    		}
    	}
    	void SpinBall(int radius, int counter, int num, int damage, bool radians){
    		npc e = Screen->LoadNPC(num);
    		Screen->ClearSprites(SL_EWPNS);
    		for(int i=0;i<5;i++){
    			eweapon ball = Screen->CreateEWeapon(EW_SCRIPT1);
    			if(i<4) ball->Tile = T_CHAIN;
    			else ball->Tile = T_HEAD;
    			ball->Damage = damage;
    			if(radians){
    				ball->X = e->X + RadianCos(counter)*(radius*(i+1)/5);
    				ball->Y = e->Y + RadianSin(counter)*(radius*(i+1)/5);
    			}else{
    				ball->X = e->X + Cos(counter)*(radius*(i+1)/5);
    				ball->Y = e->Y + Sin(counter)*(radius*(i+1)/5);
    			}
    		}
    	}
    }
    Well, I wrote this earlier and I thought I'd share cause it's quite easy to use, and it makes for quite nice mini-bosses, or even just an addition to normal enemies.

    D0: Number of enemy on the list to give the mace to
    D1: Max radius of the mace. Set to a value greater than 20, otherwise hell may ensue.
    D2: Damage for mace to deal

    Set the two constants at the top to be what you want the chain and the mace head to be.
    The chain is just made up of little circles, so it's a bit like the LA one.

    You can only have one mace enemy on a screen, and it shouldn't really be paired with enemies that shoot fireballs or anything (cause they won't work).
    It can be attached to any enemy, so if you really like, you can give it to at tektite.
    I tried it earlier.
    It's less fun than you might think really.
    Maybe a mace-carrying gel is what some of you were looking for though?
    I don't know.

    I prefer it on a Darknut.

    What it does is:
    Spin round 2 or 3 times at D1 radius, then move in to a radius of 20, spin really quickly a couple of times, then launch off at Link, then start over.

  2. #2
    Lynel
    Join Date
    Jul 2005
    Posts
    1,726
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,605
    Level
    21
    vBActivity - Bars
    Lv. Percent
    37.8%

    Re: Mace Enemy

    Would you be able to make the weapon center around the top-left corner of the enemy sprite?

    example:

  3. #3
    &&
    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,303
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.7%

    Re: Mace Enemy

    Oh yeah sure, I think the version I'm using actually does that. It's a bit stripped down, but more like the GB enemy, d‘yuwant that version?

  4. #4
    Lynel
    Join Date
    Jul 2005
    Posts
    1,726
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    4,605
    Level
    21
    vBActivity - Bars
    Lv. Percent
    37.8%

    Re: Mace Enemy

    Yessir plz! O;

  5. #5
    &&
    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,303
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.7%

    Re: Mace Enemy

    Code:
    const int T_CHAIN			= 3277;
    const int T_HEAD			= 3276;
    //Give an enemy a mace to swing at Link
    ffc script E_Mace{
    	void run(int num, int maxradius, int damage){
    	int counter = Rand(360);
    	int spintimer;
    	int radius = maxradius;
    	int x; int y;
    	int ret;
    		Waitframes(4);
    		npc e = Screen->LoadNPC(num);
    		while(e->isValid()){
    			spintimer = 0;
    			//spin
    			while(spintimer < 120 && e->isValid()){
    				SpinBall(radius,counter,num,damage,false);
    				if(spintimer%30 == 0) Game->PlaySound(SFX_BRANG);
    				spintimer++;
    				counter = (counter+10)%360;
    			Waitframe();
    			}
    			//throw at Link
    			x = Link->X;
    			y = Link->Y;
    			counter = 4;
    			ret = 1;
    			while(e->isValid() && counter > 0){
    				SpinBall(counter,ArcTan((x-e->X),(y-e->Y)),num,damage,true);
    				if(Abs(x-(e->X + RadianCos(ArcTan((x-e->X),(y-e->Y)))*counter)) < 4
    				&& Abs(y-(e->Y + RadianSin(ArcTan((x-e->X),(y-e->Y)))*counter)) < 4){
    					if(ret == 1){
    						Game->PlaySound(SFX_HAMMER);
    						Pause(counter,ArcTan((x-e->X),(y-e->Y)),num,damage);
    					}
    					//return
    					ret = -1;
    				}
    				counter += 4*ret;
    			Waitframe();
    			}
    			Pause(0,0,num,damage);
    			//bring back to main spin position
    			counter = Floor(ArcTan((x-e->X),(y-e->Y))*180/PI);
    			radius = 0;
    			while(radius < maxradius && e->isValid()){
    				SpinBall(radius,counter,num,damage,false);
    				radius += 2;
    				counter = (counter+3)%360;
    			Waitframe();
    			}
    		}
    		Screen->ClearSprites(SL_EWPNS);
    	}
    	void Pause(int r, int c, int n, int d){
    		for(int i=0;i<10;i++){
    			SpinBall(r,c,n,d,true);
    		Waitframe();
    		}
    	}
    	void SpinBall(int radius, int counter, int num, int damage, bool radians){
    		npc e = Screen->LoadNPC(num);
    		Screen->ClearSprites(SL_EWPNS);
    		for(int i=0;i<5;i++){
    			eweapon ball = Screen->CreateEWeapon(EW_SCRIPT1);
    			if(i<4) ball->Tile = T_CHAIN;
    			else ball->Tile = T_HEAD;
    			ball->Damage = damage;
    			ball->CSet = 8;
    			if(radians){
    				ball->X = e->X-8 + RadianCos(counter)*(radius*(i+1)/5);
    				ball->Y = e->Y-8 + RadianSin(counter)*(radius*(i+1)/5);
    			}else{
    				ball->X = e->X-8 + Cos(counter)*(radius*(i+1)/5);
    				ball->Y = e->Y-8 + Sin(counter)*(radius*(i+1)/5);
    			}
    		}
    	}
    }
    That should be the right one.

  6. #6
    Octorok Beta Link's Avatar
    Join Date
    Jan 2007
    Age
    30
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,124
    Level
    11
    vBActivity - Bars
    Lv. Percent
    52%

    Re: Mace Enemy

    Dude... This is just what I need for an enemy in Kanalet Castle in IoD...

    *yoinks*

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