Enemy Type?

Blitz3D Forums/Blitz3D Beginners Area/Enemy Type?

Hotshot2005(Posted 2009) [#1]
Now I am using Enemys Type for beat em up like this

Type Enemy
Field Image ; Image
Field X,Y ; Enemys Position
Hit ; Or Damage
Dead ; Dead = 1 mean he is Dead, Dead = 0 mean he is alive
End Type



What does anyone know think of my type above....


Hotshot2005(Posted 2009) [#2]
Is someone going help me on Type above?


puki(Posted 2009) [#3]
Well, it isn't a legitimate type without everything set-up with Fields.

With that achieved, then it is useable. Depends on your game.

You may want a Health field so that you can track their health level. This means you won't need a Dead field.


Hotshot2005(Posted 2009) [#4]
Type Enemy
     Field Image  ; Image
     Field X,Y    ; Enemys Position
     Field Health ; Enemy Health
     Field Hit    ; If the Enemy been Hit
End Type

Type Boss
     Field Boss.Enemys  ; Inherit from Enemys Types << Is this correct?
End Type
     


thank puki, I dont think I could add anymore as I think that is perfect for enemys types and I have add the boss too but I dont know if I got it right for inherit from enemy type


GIB3D(Posted 2009) [#5]
Yea that's right :) I was surprised when I found out you could use Types within Types. Oh and btw you put Boss.Enemys instead of Boss.Enemy


Hotshot2005(Posted 2009) [#6]
Thank you for spotting the errors GIA_GREEN_FIRE_


Santiworld(Posted 2009) [#7]
field agresivity? to make diferent lvl of difficult to kill him?


Hotshot2005(Posted 2009) [#8]
DO u mean aggresivity? That is interesting.....for example...the first level boss would harder than the enemys then you got different level of enemys who are slow and stupid or fast and clever and so on.


Ross C(Posted 2009) [#9]
Special power bar maybe? As in street fighter, and other fighters, you build up a bar for attacking, and when it's full you can unleash a special attack.

What about different costumes? You will need a flag in your type field for that to choose a different image strip.

Weakspots on a player?


Santiworld(Posted 2009) [#10]
all the enemys are the same?

field (type of enemy)

if the enemy type = "orge" then
bla bla

if enemy type = "??" then...


with this field, you can use diferents ia for each type of enemy..

what kind of game you want to make?


Hotshot2005(Posted 2009) [#11]
All the enemys are the same?

All the enemys will have different skill....for example....one enemys is fast where other enemys is slow and so on

What kind of game you want to make? Scrolling beat em up.


Mahan(Posted 2009) [#12]
Could someone just clarify one thing that I don't get from this code:

Type Enemy
     Field Image  ; Image
     Field X,Y    ; Enemys Position
     Field Health ; Enemy Health
     Field Hit    ; If the Enemy been Hit
End Type

Type Boss
     Field Boss.Enemy  ; Inherit from Enemys Types << Is this correct?
End Type



From my understanding Boss does not inherit or extend the Enemy type, does it?

It's just a field of a type that happens to be a type.

I.e. to use the code above you'll have to:

b.Boss=new Boss
b\Boss=new Enemy

And to access for example the X of the Boss.Enemy field of the Boss you'd need to:

print b\Boss\X

If this indeed was inheritance or extension you'd simply use it like this:

b.Boss=new Boss
print b\X ; X directly accessible from Boss-type since it has inherited/extended Enemy


My point is that Boss.Enemy is not inheritance or extension at all but simply a subfield of the Boss type, am I right?


_PJ_(Posted 2009) [#13]
Seeing as this is in the Blitz3D area, I presume that the enemies are going to be entities of some kind.
On that presumption, I consider the following fields to be somewhat redundant:
X,Y, Image, Dead
Making the Type now declared as:
Type Enemy
Field Entity%
Field Health%
End Type


To obtain X,Y
EntityX(MyEnemy.Enemy\Entity%)
EntityY(MyEnemy.Enemy\Entity%)

You should know if they have been hit because MyEnemy.Enemy\Health% will be decreased.
If they are dead, the MyEnemy.Enemy instance can be removed when
If Not (MyEnemy.Enemy\Health%)
Occurs.


Gabriel(Posted 2009) [#14]
My point is that Boss.Enemy is not inheritance or extension at all but simply a subfield of the Boss type, am I right?

Yes, you're correct. It's generally referred to as "composition".


Hotshot2005(Posted 2009) [#15]
It keep saying Dubilcate Variable and what I am doing wrong

Type Player
     Field Image [50] ; Image Arrays
     Field X,Y        ; Player Position
     Field Health     ; Player Health
     Field Hit        ; If the Player been Hit
End Type
     

Type Enemy
     Field Enemy.Player  ; Inherit from Player Types 
End Type


Type Boss
     Field Boss.Enemy ; Inherit from Player Types 
End Type



Hotshot2005(Posted 2009) [#16]
Ok now as I fixed it