Making multiple entities with same handle

Blitz3D Forums/Blitz3D Programming/Making multiple entities with same handle

DodgeCodingOwner(Posted 2016) [#1]
Is there any way to use Types (or anything else) to create many cubes with the same handle?
I don't want to have to do this with 400 different handles:
cube1=CreateCube()
;make cube1 surfaces,vertices,triangles
cube2=CreateCube()
;make cube2 surfaces,vertices,triangles
and so on...


Bobysait(Posted 2016) [#2]
This topic is probably a replicant of this one :
http://www.blitzbasic.com/Community/posts.php?topic=106879


RemiD(Posted 2016) [#3]
of course, you can load/create a premade shape and then copy it many times and store its properties in a dim arrays list or in a customtype list

you can see an example in these codes :
with dim arrays : http://www.blitzbasic.com/codearcs/codearcs.php?code=3094
with customtypes : http://www.blitzbasic.com/codearcs/codearcs.php?code=3095

search for "Balls" or "Crates" or "Barrels" and take a look at the code related to that, but don't care about the collisions/linepicks stuff, you probably don't need it for now...


DodgeCodingOwner(Posted 2016) [#4]
Thank you both! I didn't even realize that I can use an array for a handle but now that I think of it it should've been obvious since a handle is just a number


Zethrax(Posted 2016) [#5]
A handle is just an integer value. You can store it it in anything that can hold an integer including variables, types, arrays, banks, etc. You can also store and retrieve it as a string value using Blitz3D's datatype conversion, which can be handy if you need to store an entity handle or a type object handle ( http://www.blitzbasic.com/Community/posts.php?topic=53348 ) in the namestring ( http://www.blitzbasic.com/b3ddocs/command.php?name=entityname&ref=goto | http://www.blitzbasic.com/b3ddocs/command.php?name=NameEntity ) of an entity in order to retrieve it when working with the collision system, etc.


RemiD(Posted 2016) [#6]
@DodgeCodingOwner>>i won't bother you with complicated concepts for the moment, but in the future, if you create tools/demos/games where there are different lists, you will realize that you need not only to be able to retrieve, for each entity, its id (index (for dim arrays list) or handle (for customtype list)) but also its list name so that you know in which list to search, that's what my 2 code examples are about. (the list name and the id are stored in the entityname)