#need help is small stuff

22 messages · Page 1 of 1 (latest)

brazen solstice
#

so I have a TD game here

it have tower, monster, and bullet classes + scenes
which are used to deal damage
now I want to deal damage + apply debuffs/effects to monster

it goes from

  • **Tower **-> spawns Bullet(contains damage and element data)
  • Bullet interact with Monster to deal damage
    -# bullet scene is area2D which detects monster area 2d

Now I want to apply effects on Monster based on the data bullet is carrying.. plus the visuals based..

I was wondering if there was something better like doing all the calculation in the bullet class etc

my idea was
creating a array of different effects (which will be given by bullet) and store them in Monster.. then they will be executed in monster

But
Im already using composition.. so dont know if I should create and use Debuff scene as a child.. but then I need movement scene separately as well or it would have to call parent to update it ughhh

glass delta
weary urchin
#

I usually use an Resource script to store attack data that can be passed along with the bullet.. You coulda also have a Resource for each buff/debuff with all their attributes instead of using match or dictionaries.

brazen solstice
#

Bullets are resource

#

thats inside resource xD

#

I just wanted the logic inside the bullet class itself

brazen solstice
glass delta
#

i hope its not a bad thing

brazen solstice
#

its fine for normal use case..

#

but Im using composition

#

the compositon main script parent may not be the node I want

glass delta
#

ic

brazen solstice
weary urchin
#

if you want to stick to composition, your buff/debuff could spawn inside the affected entity.

brazen solstice
brazen solstice
#

this is whats working right now

#

but I do have to pass in Main Scene to bullet