User Tag List

Results 1 to 3 of 3

Thread: Hop Around (movement pattern for boss)

  1. #1
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,611
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.85%

    Hop Around (movement pattern for boss)

    To follow up the exceeingly simple enemy_ghost idea, I'll be posting enemy movement patterns as I code them. Put these codes on the invisible FFC that your custom boss FFCs are linked to.

    This one makes the enemy hop around the room (ala Hardman in MM3).

    Code:
    // ============================================
    // hop_around - This script is designed to script a hopping enemy
    // in a sideview area.  The FFC will target the player's location, 
    // then hop into the air and fall on that location. 
    // D0 - The speed at which the enemy moves.
    // D1 - The delay before each hop.
    // D2 - Drop delay (the time the enemy will take to get to the 
    // drop location, and wait there.  If this value is too small, the
    // enemy will drop before getting above the player.  If it is too
    // large, the enemy will hang in the air before dropping.
    // D3 - The height the enemy jumps to before falling.
    // D4 - The Y value of the floor of the room
    // ===========================================
    
    ffc script hop_around{
    
    	void run (int speed, int hop_delay, int drop_delay, int height, int floor_level){
    
    		int state = 0;		// The state of this hopper
    					// 0 = resting
    					// 1 = hopping
    
    		int hdelay_counter = hop_delay;		// Counters
    		int ddelay_counter = drop_delay;		
    
    		int target_x;		// Stores the player's x location at the start of a hop
    		int target_y;		// Stores the player's y location at the start of a hop
    
    		while(true){
    	
    			if(state == 0){
    			
    				if(hdelay_counter <= 0){
    					state = 1;
    					hdelay_counter = hop_delay;
    					ddelay_counter = drop_delay;
    					target_x = Link->X;
    					target_y = Link->Y - height;
    				}
    				else{
    					hdelay_counter--;
    					if(this->Y > floor_level){
    						this->Vy = 0;
    						this->Vx = 0;
    					}
    					else{
    						this->Vy = speed;
    						this->Vx = 0;
    					}
    				}
    			} // end of state 0
    
    			if(state == 1){
    
    				if(ddelay_counter >= 0){
    					if(this->X < target_x){ this->Vx = speed; }
    					if(this->X > target_x){ this->Vx = -speed; }
    					if(this->Y < target_y){ this->Vy = speed; }
    					if(this->Y > target_y){ this->Vy = -speed; }
    					ddelay_counter--;
    				}
    				else{
    					state = 0;
    				}
    			} // end of state 1
    
    			
    
    			Waitframe();
    		} // end of while loop
    	} // end of void run
    } // end of ffc script

  2. #2
    Cor Blimey! CJC's Avatar
    Join Date
    Dec 2002
    Location
    Fading into the darkness
    Age
    35
    Posts
    1,398
    Mentioned
    150 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,621
    Level
    25
    vBActivity - Bars
    Lv. Percent
    1.39%

    Re: Hop Around (movement pattern for boss)

    I suppose it's a bit early to be asking this, but would it be possible to set up a script like this so that the enemy_ghost FFC alternates between different movement styles? Possibly some randomly and some based on Link's proximity?



    Even if that's outside the realm of possibility, I still find these scripts of yours facinating. I'm going to enjoy exploring this.
    I'm an author. If you're interested in checking out my works, you can find them on Amazon.com:


  3. #3
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,611
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.85%

    Re: Hop Around (movement pattern for boss)

    Sure it would be. You'd have to incorporate two movement scripts into the same ffc script, though.

    Alternatively, I guess you could have several invisible FFCs performing different movement patterns, and then your boss FFC would change which FFC it was linked too. You'd have to be mindful of getting the FFCs to the same x,y location when it switched between them, though.

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