noob type help
Blitz3D Forums/Blitz3D Beginners Area/noob type help
| ||
im trying to change 1 of 4 picked types fields ,but im new to types and dont have a clue how to do this. can someone please show me how this is done. thanks. (i know the code below wouldn't work i just wanted to show what i mean) dim character (4) type character field life end type If CameraPick(cam,MouseX(),MouseY()) = character(4) Then If MouseHit(1) Then character\life = character\life - 2 EndIf EndIf |
| ||
why not loop through all of them, if its only 4 then it shouldn't be to bad of a performance hit.type character field life,ent end type ;later in a function or in the loop for char.character=each character If MouseHit(1) ; i rearranged these 2 lines for performance If CameraPick(cam,MouseX(),MouseY()) = char/ent Then char\life = char\life - 2 EndIf EndIf next |
| ||
thanks for the help mtnhome3d but that didnt seem to work :( . |
| ||
oh well i didn't actually test it, i'll write an example now. ok here's my example |
| ||
thank you for the example mtnhome3d its helped me understand types a lot better. I tried to add a second cube but it didnt work properly. Could you add a second cube to your example please?. |
| ||
Use this tutorial; http://www.hpquest.com/techlord/apps/AOBPwB3D/ |
| ||
thanks mortiis, I had trouble finding a good tutorial. |
| ||
to add another cube you do thisfor q=1 to 2; this sets the number of cubes you want p.player=New player ; creates a list for the type p\e=CreateCube(); creates a cube under the p\e var p\life=100;sets p\e to 100 PositionEntity p\e,rnd(-10,10),rnd(-10,10),30; puts it 30 units infront of the camera EntityPickMode p\e,2;sets it to be pickable EntityColor p\e,234,65,107; sets a random color that i pulled out of a hat :) next |
| ||
thanx again mtnhome3d, when i tried to add another cube before you posted your last example i used "for i = 1 to 2 " but only one cube was being affected by the campick (which is whats happening now) and i presumed i hadn't done it correctly, I also tried using the this.pointer from the tutorial but that didnt work either, do you know why only one cube is affected by the pick now? |