collide with "any enemy" cause 20 "global damage" (grouping)

Talk about making games.

collide with "any enemy" cause 20 "global damage" (grouping)

Postby stevenp » Mon Mar 17, 2008 2:07 am

i have a situation that i have been avoiding for 2 months, causing "global damage" instead of "individual damage"

this is how my game is CURRENTLY set up

// when shock bolt colides with enemy1... enemy1's health goes down 20
// when shock bolt colides with enemy2... enemy2's health goes down 20
// when shock bolt colides with enemy3... enemy3's health goes down 20.....
//.... when shock bolt colides with enemy125... enemy125's health goes down 20

you can see my point and how inefficiant this is, and how it will take much time in the long run

what i would like to know how to do is this

// when shock bolt collides with "any enemy" cause 20 "damage" to that enemy

so i need to know how would you create a "group" called "enemy group" and "global damage" so when ANY enemy gets hit by the shock bolt, his health goes down by 20

is this possible?

i appreciate any help :D[list=][/list]
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: collide with "any enemy" cause 20 "global damage" (grouping)

Postby DilloDude » Mon Mar 17, 2008 5:04 am

I use a stats actor variable, and set individual bits up as properties (see here). I'd have a stat for either damageable or damages (and some other properties that may take effect). Then do a collision with any actor. For example, on a bullet type of thing, it might be
Code: Select all
if (collide.stats & bDAble)
{
    collide.health --;
    DestroyActor("Event Actor");
}
else if (collide.stats & bSolid)
{
    DestroyActor("Event Actor");
}


In my current project, I'm doing it the other way around. On the object that gets hit, collision with any actor, something like this:
Code: Select all
if (collide.stats & bDamages)
{
    //check other stats about attack type
    health -= collide.strength;
    if (collide.stats & bForces)//another property, whether a colliding actor should bounce away
    {
        //whatever bounce effect
    }
    collide.signal ++;//a variable to store when the actor has hit something. The shot checks this on draw actor and destroys itself if necessary
}
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: collide with "any enemy" cause 20 "global damage" (grouping)

Postby stevenp » Thu May 22, 2008 12:11 am

ok, for some reason it is giving me an error, ILLEAL STRUCTURE OPERATION even tho i followed fuzzy's steps..

i dont understand why this is the case
Last edited by stevenp on Thu May 22, 2008 1:35 pm, edited 1 time in total.
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: collide with "any enemy" cause 20 "global damage" (grouping)

Postby makslane » Thu May 22, 2008 12:18 am

The code Stick.Traits = something will works only if Traits was a Actor variable, not a global variable
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: collide with "any enemy" cause 20 "global damage" (grouping)

Postby stevenp » Thu May 22, 2008 7:41 pm

ok that actor variable thing you said worked fine, this mehtod has 1 last step to it,

but i must be missing something...

when the green actor collides on one actor, it plays both sounds

it shouldent do that, what am i doing wrong?
Attachments
why no work!!.zip
(36.31 KiB) Downloaded 121 times
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: collide with "any enemy" cause 20 "global damage" (grouping)

Postby pyrometal » Fri May 23, 2008 12:43 am

A solution, a lot less work than other methods: The code are centralized within every projectiles instead, and it does all the work.

Damage programing.zip
Simple and effective
(208.14 KiB) Downloaded 145 times


Drag the projectile actor into the enemy actors and see the behavior!
SPRITE WARRIOR:
Free, open-source & crossplatform pixel art editor (currently under construction).
User avatar
pyrometal
 
Posts: 706
Joined: Wed Nov 28, 2007 4:07 am
Location: Kingston, ON, Canada
Score: 86 Give a positive score

Re: collide with "any enemy" cause 20 "global damage" (grouping)

Postby stevenp » Fri May 23, 2008 12:46 am

thank you!

eternal legacy v2 can now continue development!

+1
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: collide with "any enemy" cause 20 "global damage" (grouping)

Postby Lexcondran » Sat Nov 15, 2008 2:10 am

YAY i get olve someones problem again like i i with Animetanks Lost Marien. :D :lol: :D
lol so yeah i did a bit with this problem of hp and added a few text if you dont understand the scripts. :D :shock: :D
Also i redid leech animation and added blood--Enemy animations and added a Castlevania 4 Midi :D 8) :D
Attachments
Did Lex.C help.zip
(222.11 KiB) Downloaded 112 times
http://www.mediafire.com/?e4zzycilztdm1qm =My RPG APP FILE V. 3.0 {7/15/2010}
http://www.mediafire.com/?tjjmmmkzyga =My editable demo of my Rpg for people V2.3
viewtopic.php?f=6&t=10247 =Link to my RPG's (4.0) Topic =]
User avatar
Lexcondran
 
Posts: 230
Joined: Thu Jul 31, 2008 6:09 pm
Location: Tucson, Arizona, USA
Score: 8 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest