Welcome, Guest. Please Login or Register.  • Help
SMF Underground
+ SHMUP-DEV » SHMUP DEV FORUMS » Assistance
|-+ enemies - dims or types?

Pages: [1]   Go Down
0 Members and 1 Guest are viewing this topic. Topic Tools  
Read December 29, 2005, 12:09:02 AM #0
paladin

enemies - dims or types?

I'm trying to decide on whether I want to use Dims or Types (Blitz3D) to store enemies.  It's a vertical shmup, so I figure everything will have set times to appear based on game time.

Any advice?  I hate running through types with a For loop.  I haven't touched the "new" Blitz Arrays yet.


needs more particles...
Offline  
Read December 29, 2005, 12:10:54 AM #1
Matt McFarland

Re: enemies - dims or types?

I store them as types..  in bmax  Undecided


<a href="http://www.mattmcfarland.com/flash/myFlashSig.swf" target="_blank">http://www.mattmcfarland.com/flash/myFlashSig.swf</a>
Offline  
Read December 29, 2005, 11:58:03 PM #2
Taiphoz

Re: enemies - dims or types?

Types in B3d or Max. Type > Dims.

You have a lot more control with a Dim, ie an array, but there is a lot more functionality to a type, plus its a lot easier to work with, and allows you to manage and work with a group of enemies or sprites at the same time in a fast easy manner.

I use Type's in B3D for all of my game objects, I have a type.bb file which holds all of my declirations.

Like..

Type Bullet
   field Owner // ( "player" , "alien 1" , "boss 1" , .. etc.... )
   field sprite  // the bullet image
   field damage   // how much dmg they deal when they hit
   field x,y,z   // position
   field speed // x,y,z and speed would be real's or floats.
   field frame  // if the sprite is an animated sprite.
   field life  // the amount of life the bullet has, normally 1
end type

global mybullet

for mybullet.bullet = each bullet
   bullet\x = bullet\x + bullet\speed
next


etc.....


Offline  
Read December 30, 2005, 01:18:44 AM #3
tesuji

Re: enemies - dims or types?

I would recommend using types as well. The syntax might initially seem more daunting than arrays but there are so many benefits once you get to grips with them.

One major benefit is that you can group all your enemy attributes together in a neat logical construct rather than having attributes scattered throughout multiple arrays. Makes it a lot easier to manage in the long run. Say you were using arrays and wanted to delete a single enemy  it might prove quite awkward. With a Type you can just use Delete to remove the enemy instance along with all its attributes.

HTH
Offline  
Read December 30, 2005, 01:47:16 AM #4
Matt McFarland

Re: enemies - dims or types?

Honestly.. in my earlier coding days, I used dims and I never got far with them.  Once I got into types, which was just recently, my brain has been able to comprehend the logic of "Type coding" other than just putting things in arrays.  The result is that I've been able to accomplish so much more.  SO much more..  You can even store arrays in these here types (in bmax) - for those who haven't used blitz, a type is just like a "class" in C.


<a href="http://www.mattmcfarland.com/flash/myFlashSig.swf" target="_blank">http://www.mattmcfarland.com/flash/myFlashSig.swf</a>
Offline  
Read December 30, 2005, 04:34:36 PM #5
paladin

Re: enemies - dims or types?

Types seem to be working ok so far.  i'm getting into some slowdown now with particles but that's a whole 'nother issue  Lips Sealed

thanks all


needs more particles...
Offline  
Read December 30, 2005, 11:39:07 PM #6
Taiphoz

Re: enemies - dims or types?

You I dont think types will slow your code down all that much, they also come with better garbage handling so your memory usage should be better . or at least more managed.


Offline  
Pages: [1]   Go Up
Jump to:  

Page created in 0.154 seconds with 18 queries.