DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[HELP] Objects that hurt like fire
Page 1 of 1
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Soldat 555
Guest



Last Visit:





PostPosted: Wed Jul 07, 2010 12:49 am
   Subject: [HELP] Objects that hurt like fire
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

In my current projects I wanna make objects that hurt... Not like mines but like fires and electricity that have an animation to them. I figured to edit the ghosts to do so but... Well this is what I did...

*WL_Act2.CPP*
Added around line 170...
::: CODE :::

void    T_Burn (objtype *ob);


Altered around line 466...
::: CODE :::

statetype s_blinkychase1        = {false,SPR_BLINKY_W1,10,(statefunc)T_Burn,NULL,&s_blinkychase2};
statetype s_blinkychase2        = {false,SPR_BLINKY_W2,10,(statefunc)T_Burn,NULL,&s_blinkychase1};


Added around line 3578...
::: CODE :::

===============
=
= T_Burn
=
===============
*/

void T_Burn (objtype *ob)
{
    int32_t    dx,dy;

    dx = player->x - ob->x;
    if (dx<0)
        dx = -dx;
    dx -= TILEGLOBAL;
    if (dx <= MINACTORDIST)
    {
        dy = player->y - ob->y;
        if (dy<0)
            dy = -dy;
        dy -= TILEGLOBAL;
        if (dy <= MINBURNDIST)
        {
            if (US_RndT()<180)
            {
                TakeDamage (US_RndT()>>4,ob);
                return;
            }
        }
    }
}


/*


Now this works, but it will actually start burning the player at a distance. I only want the hazard to hurt if the player's standing on the object. What changes would I need to do to have that happen?


Thunderstorm Joshua M@d Wolf Waight Thunderstorm
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 30 Nov 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Wed Jul 07, 2010 9:07 am
   Subject: [HELP] Objects that hurt like fire
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

In this case, all you need is to check if the player's tile coordinates match the object's tile coordinates. So for your T_Burn function, I would just put something like this:

::: CODE :::
void T_Burn (objtype *ob)
{
    if (player->tilex==ob->tilex && player->tiley==ob->tiley)
        TakeDamage (US_RndT()>>4,ob);
}
Soldat 555
Guest



Last Visit:





PostPosted: Wed Jul 07, 2010 3:36 pm
   Subject: Re: [HELP] Objects that hurt like fire
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Thanks, WSJ. It worked! Smile


Thunderstorm Joshua M@d Wolf Waight Thunderstorm
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 11726 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 3165 Sun Jul 20, 2008 7:56 am
Haasboy View latest post
No new posts [Wolf4SDL Help] Inserting a second palette (like in SoD)
Author: Andy_Nonymous
10 3534 Mon Jun 02, 2008 3:59 pm
Adam Biser View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 3375 Sat May 17, 2008 11:26 am
Mortimer View latest post
No new posts [help] Wolf4sdl's implemented tutorials
Author: Mortimer
6 3494 Tue May 06, 2008 1:15 pm
Ripper View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group