Why would CopyEntity() return an invalid entity?
Blitz3D Forums/Blitz3D Programming/Why would CopyEntity() return an invalid entity?
| ||
I haven't had sleep in a day or two, so this may be something really stupid, but why would CopyEntity() return a handle to an entity and then any Entity command I use on that handle give me an "entity does not exist" error? This code sample shows what I mean, I guess PositionEntity t\sprite,10,10,10 p\sprite=CopyEntity(t\sprite) EntityAlpha p\sprite,0.5 So t\sprite must be there, because I position it right before I copy it ( just to prove to myself it was there. ) But EntityAlpha ( or any other entity command on the "supposedly copied" p\sprite errors me with "entity does not exist". Note, it returns a long integer, just like en entityhandle. It does not return zero. Probably something stupid, but I'll be damned if I can see it. |
| ||
Strange.. Try with another entity which is not a sprite, like for example a cube. Perhaps a sprite needs to be instantiated first: p\sprite = createsprite() p\sprite = copyentity(t\sprite) How did you create the t\sprite one ? The same passes should be applied to p\sprite, I think. I'm only guessing here, since I'm at office = no blitz Hope this helps, Sergio. |
| ||
I created t\sprite with t\sprite=LoadSprite("textures\star.png") I am certain that this method ( loading a sprite to t\sprite and copying to another type to get instances of it ) works because I'm using it for some other sprites elsewhere in the program and they're showing up just fine. EDIT: Yup, I replaced LoadSprite with CreateCube() and I get the same error. It's weird. |
| ||
Only thing I can think of atm is that t\sprite is a float and not an integer. Second thought that doesn't make much sense tho -.- |
| ||
Only a complete moron would declare t\sprite as a float, and yes, sir, I'm that complete moron ;) I should stop coding at 5am like normal weird obsessives. Thanks, Shambler, VERY well spotted. That would have taken me forever to spot. |
| ||
lol |
| ||
Goal! lol |