User Tag List

Results 1 to 2 of 2

Thread: Link Injured Animation (In Progress)

  1. #1
    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.48%

    Link Injured Animation (In Progress)

    You know how the classic set comes with 'hurt' tiles? Well I thought I'd find a script that could make the game actually USE them... but when I searched in the usual places I saw nothing.

    So I took a shot at writing one myself.

    NOTE: This is incomplete! Do not drop it into your ZQuest or angry leprechauns will steal your keyboard!

    Code:
    //Sets up a sprite to take the place of Link when he takes damage
    //Used to create an injury animation.
    //Injury tiles should be arranged in a column, in this order:
    //North, South, West, East
    
    //Sets the north-facing tile when Link is hurt on land (Change as needed)
    const int TILE_GOTHURTLAND = 0;
    //Sets the north-facing tile when Link is hurt in water (Change as needed)
    const int TILE_GOTHURTWATER = 0;
    
    
    int hurtTile; //Used for a calculation
    int currentLTM; //Used to hold Link's cumulative LTM as we calculate it
    
    //NOTE: This loop will not compile on its own, I intend to place it in
    //a global script.
    while (Link->Action == LA_GOTHURTLAND || Link->Action ==LA_GOTHURTWATER){
    	//Hides Link while he is hurt
    		Link->Invisible = true;
    	
    	//Runs through all of Link's Items (HOPEFULLY) to collect their tile modifiers
    	for(int i=0, i<512, i++){
    		item tileModSearch = Link->Item[i];
    		currentLTM += tileModSearch->Extend;
    	}
    	if (Link->Action == LA_GOTHURTLAND){
    		//Draws the Link Hurt tile for land
    		hurtTile = TILE_GOTHURTLAND + (Clamp(Link->Dir,0,3) * 20) + currentLTM;
    		Screen->FastTile(0, Link->X, Link->Y, hurtTile, 6, 128);
    	else{
    		//Draws the Link Hurt tile for water
    		hurtTile = TILE_GOTHURTWATER + (Clamp(Link->Dir,0,4) * 20) + currentLTM;
    		Screen->FastTile(0, Link->X, Link->Y, hurtTile, 6, 128);
    	}
    	Waitframe();
    }
    This would be dumped somewhere into the global script.

    I was wondering if this kind of loop could be made more efficient, or if there's some kind of function that can directly snatch Link's cumulative LTM. My recent studies of computer programming have driven me to want more elegant programming solutions. Should I extract the 'For' loop and establish it as a global method instead of embedding it in the middle like that? Since this segment of code will be within the non-terminating While() loop of the global function, would a regular 'if' loop be better than a 'while' loop? You know, things like that.


    EDIT: Should I try to turn this into a generic utility function? Of the form:

    LinkAnimation(int AnimationId, int StartingTile, bool RowOrColumn, bool LinkIsVisible)


    If we could come up with something like that, we could shove this in a header file and make this sort of thing easier to implement.
    ...Come to think of it, I should go check some header files. Maybe somebody's done this already.
    Last edited by CJC; 09-30-2013 at 05:24 PM. Reason: Error with Clamp Method

  2. #2
    How many licks to get to the center Chris Miller's Avatar
    Join Date
    Mar 2001
    Location
    of a Tootsie Roll Pop?
    Age
    46
    Posts
    3,511
    Mentioned
    94 Post(s)
    Tagged
    4 Thread(s)
    vBActivity - Stats
    Points
    5,668
    Level
    23
    vBActivity - Bars
    Lv. Percent
    38.85%
    Neat.
    You should do one for bosses too.

    Download Lands of Serenity today! You will be knocked comatose by its sheer awesomeness.
    The Titan's Quest, best played in the bathroom as the excitement can be somewhat...overwhelming.





    Official AGN Discord Channel

    Official ZC Dev Discord Channel

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