How do I use the type function?
BlitzPlus Forums/BlitzPlus Beginners Area/How do I use the type function?
| ||
Hello, I need to know how to make a type command.I need to know how to use this function so I can create more than 1 of my enemies. Also, I need to know how to tie the type in with an image.The user guide does not have a very in depth tutorial on types. Can anyone help? |
| ||
Type is not a command, but a definition: it doesn't "do" a thing with any kind of effect, but rather describes something that will exist later. I tried to get this across in a long post you can see here: http://www.blitzbasic.com/Community/posts.php?topic=99321#1165288 |
| ||
This is a little program that includes a very simplified Enemy Type where each enemy uses a copy of the same, master image. The enemy images are then drawn in a loop which iterates through all the 'Enemy' type instances. This should help with the concept, but really, I do receommend looking at Yasha's link given above, and some of the other threads around because Types can be very powerful and useful once you understand them well! |
| ||
Wow thanks both of you guys.I have a question PJ at this part of the program For IterateEnemies.Enemies = Each Enemies MoveEnemy(IterateEnemies.Enemies) DrawImage IterateEnemies\Image,IterateEnemies\X,IterateEnemies\Y where it says image right after IterateEnemies would I put the global name for my enemy's .bmp image? |
| ||
Sorry Ethan, for some reason, it seemed half the code was missing from the example. I've reposted it fully now (I had to rewrite it, but it's essentially the same). If you want to use a global image, then you do not need to use MyImage\Image but should replace it with the Image handle for your global Image. I had originally envisaged using a separate image for each Type instance, but since you mentioned a global image, the edited code above shows how to use the global Master Image for all Enemies. |
| ||
Oh makes more sense now thanks a lot. Going back to my program now and , its going to have types. You guy were a lot of help. |