Somr Type & Plug-in Questions

Blitz3D Forums/Blitz3D Beginners Area/Somr Type & Plug-in Questions

Verminaard(Posted 2003) [#1]
Howdy,
Could anyone clear up a few points for me? Ok, the first question is about the for / each loops. Say, i am creating a simple space invaders style game or something, and i define the following type to hold the aliens details.

type alien
field Xpos,Ypos,Xspeed,Yspeed,Image etc.....
end type

now, i want several different types of aliens, so, say i create 5 instances of alien 'A' and 'B':


for x = 1 to 5
A.alien = new alien
*assign A's field values here*
B.alien = new alien
*assign B's field values here*
next

so, to bottom line it, if i then run for / each loop:

for a.alien = each alien
* do something intresting in here :D*
next

will the loop run through all instances of the alien object (IE: including the b.alien instances) or will it only limit the loop to the a.aliens?

Also, in a for/ each loop, i am pretty sure i have seen people using the 'this' command, although i cant remember where. Can the 'this' command be used to send the current instance of the object in the loop into a sub-routine or something similar? for example, using the objects created above:

for a.alien = each alien
*do some stuff here*
check_alien_death(this alien)
next

function check_alien_death(currentAlien)
if currentAlien\health = 0 then delete currentAlien
end function

The next question is about the 'plugins' that are available for blitz. I have seen lots of people creating helper programs and such to speed up people's game dev times and i was wondering how most of them are created? Are they written in BB? or do people use programs such as VB or something similar to make them? If so, could anyone point me in the general direction of some tut's on making them as i am quite a competent VB programmer, but i dont really know the specs i would need to have it, ummm interface (for want of a better word :D), with BB. Has anyone done any good articles on it.

While i am here, does anyone know of a good tutorial, something along the lines sss's 'Creating a platform game' but for a simple FPS in 3D? I have been playing around with 2D for some time, but i would like to start on a 3D one now, but there doesnt seem to be too many tut's on B-coder for 3D beginners......


SopiSoft(Posted 2003) [#2]
will the loop run through all instances of the alien object (IE: including the b.alien instances) or will it only limit the loop to the a.aliens?


the loop will run through all instances of the alien object.

Also, in a for/ each loop, i am pretty sure i have seen people using the 'this' command, although i cant remember where. Can the 'this' command be used to send the current instance of the object in the loop into a sub-routine or something similar? for example, using the objects created above


The "this" operator is not supported in Blitz AFAIK.

The next question is about the 'plugins' that are available for blitz. I have seen lots of people creating helper programs and such to speed up people's game dev times and i was wondering how most of them are created? Are they written in BB? or do people use programs such as VB or something similar to make them?


These plugins are called userlibs and are DLL's written in languages like C/C++ , Delphi, VB


Ross C(Posted 2003) [#3]
Hey, do you really need to give each alien a letter?

eg.

a.alien=new alien
b.alien=new alien

couldn't you just say

a.alien=new alien
a.alien=new alien


SopiSoft(Posted 2003) [#4]
@ Joker: if you give them the same name then they are both added to the typelist but then it's hard to distinguish them from eachother so you need to do some sort of flagging like giving them a name that you store in "a\name$".
But if you make a.alien and b.alien global then you can distinguish them by just refering to them as a.alien and b.alien


Ross C(Posted 2003) [#5]
Oh rite. i see now. :) thanks.