plop problem
Blitz3D Forums/Blitz3D Programming/plop problem
| ||
I am having a bit of a bugabear problem... I want to clear the baord and plop new cubes but it doesn't seem to want to do that... I know it is me and I am hoping one of you geniuses can helpage me... There are a lot of good things there... Am I thinking like an Atari Programmer again??? : ) -RZ |
| ||
One solution is to parent everything to a pivot, then FreeEntity the pivot when you need to reset the game... |
| ||
I think there are tablets available for that!!!! |
| ||
actually I have cubes with each side a different color and was thinking or rotating them to change the color... Hmmm. Blackjumper your code is great... I don't undertand how freeentity on the pivot would reset the game though... I will re read that section... I thought I read it. I even tried ClearWorld (entity) but no joy! Think I will try to code it into a block switch game to see how that is done. Still learning. -RZ |
| ||
@Rook: sorry for the imprecise comments above... What I meant to say was 'reset the board' rather than 'the game'. FreeEntity on a parent will clear up both the parent (the pivot) and any children of that entity, so in this case it 'deletes' all of the copies of the meshes, ready for you to redraw the board. To reset the game you would need to reDim all your arrays and reset variables, etc. (possibly by using Goto startlabel ??) |
| ||
OK... but you know I still have a problem. OK I have many problems according to my wife... but I digress. I tried the same bit of code in another game I have almost finished. It does not work. I am loathe to post the code here in case some 14 year Script Kiddy steals it and claims credit for it in his computer class. I used to teach Art and Computers in Middle School... : ) Now in that game I don't use mesh primatives like the cubes here... I use a button shaped piece created in rhino. Could this be the problem? Each time I load a new level I get 20000 tris added to the rendermix. It starts 22422 for the first level... then 42422 for the second etc... I have (in desperation) dropped the freeentity pivot code all over the place... Agggh!!! -RZ |
| ||
Are you making each button a child of the pivot when it is created ? My first stab at fixing your 'blocks' code above, I tried parenting the mesh, mesh2, mesh3, etc., to the gamePivot, but got problems of non-existant entities when calling setupboard(). I then realised that you were just using these as 'templates' to be CopyEntity-ed, so all the parenting actually happens in the setupboard() routine. Make sure that you only load the button ONCE outside the main game loop and that any functions that then set up the environment (eg. level) make a levelPivot the parent of each CopyEntity to create the onscreen buttons. Global buttonMesh = LoadMesh("rhinothing.b3d") HideEntity buttonMesh Global levelPivot = CreatePivot() ... ... SetupLevel() Repeat ... ;MainGameLoop If (new level condition) Then FreeEntity levelPivot levelPivot = CreatePivot() SetupLevel() EndIf ... Until 0 ;================================================ Function SetupLevel() for x = 1 to NUMBERBUTTONS x = CopyEntity(buttonMesh, levelPivot) ... PositionEntity x, xPos, yPos, zPos NextEnd Function ... something like that. You may need to ShowEntity for each copy - not sure if 'hidden' will be inherited. |
| ||
Yeah I thought it might be something like that. I just need to put the buttons on the board and color them... then recolor them yadda yadda... Thanks! THAT DID IT!!!! Dude... you may not be in my will but you are certainly on my Christmas list! : ) -Rook ZImbabwe |
| ||
plop problem, eh? I find soft-centred chocolates help... or bran flakes. If it's the other way round, eat dry biscuits! |
| ||
dry biscuits??? Like doggy biscuits??? ; ) You mean cookies or crackers??? I used pepto... always seems to work! -RZ |