Help
Blitz3D Forums/Blitz3D Beginners Area/Help
| ||
{code};Basis Functions and Types Type Rock Field x,z,y,RockType,Name$ Field model,modeltex,state,maxhits Field currenthits Field tooltip$ Field requiredlevel Field regen End Type Type item Field x,z,y,where,quantity Field ItemType,SellValue,BuyValue,Sellable Field name$,tooltip$ End Type Type Pickable Field x,z,y,quantity,regenrate,model,modeltex Field name$,tooltip$ End Type ;rock types ;1 = copper ;2 = tin ;3 = iron ;rock states ;1 full hits ;2 half gone ;3 gone Function UpdateRock(rock1.rock) If rock1\RockType = 1 rock1\name$ = "Copper" rock1\tooltip$ = "This is a minable rock" rock1\maxhits = 5 rock1\regen = 7 EndIf If rock1\rocktype = 2 rock1\name$ = "Tin" rock1\tooltip$ = "This is a minable rock" rock1\maxhits = 5 rock1\regen = 7 EndIf If rock1\rocktype = 3 rock1\name$ = "Iron" rock1\tooltip$ = "This is a minable rock" rock1\maxhits = 4 rock1\regen = 10 EndIf If rock1\maxhits >= rock1\currenthits rock1\state = 1 EndIf If rock1\maxhits / 2 = rock1\currenthits rock1\state = 2 EndIf If rock1\currenthits = 0 rock1\state = 3 EndIf End Function Function SetRockType(rock1.rock,roktype) rock1\rocktype = roktype UpdateRock(rock1) End Function Function MineRock(rock1.rock) Repeat .sub rock1\currenthits = rock1\currenthits - 1 Until rock1\currenthits <= 0 .checksub If rock1\currenthits > 0 Goto sub EndIf Goto checksub Delay (rock1\regen * 1000) rock1\currenthits = rock1\maxhits End Function {/code} The above code is a file to include {code} Graphics3D 800,600,0,2 Global AppVersion# = .5 Global Copper = 1 Global Tin = 2 Global Iron = 3 rock = True Include "Basis.bb" AppTitle ("ZScape Version " + AppVersion#) WaitKey() Copper1.rock = New rock SetRockType(Copper1,Copper) copper1\currenthits = 5 WaitKey() .top If rock = True MineRock(copper1) rock = False EndIf If KeyHit(28) Goto next1 EndIf Goto top .next1 Cls Print copper1\currenthits Delay(3000) Goto next1 {/code} Why wont this work? |
| ||
I don't know. What does (or doesn't) it do? You need to be much more descriptive with A) Thread titles, and B) the problem itself. If you can't be arsed to tell us what the problem is, then people won't bother to even look. Glad to see you've figured out that other people can't reply to your worklogs though. |
| ||
Hmmmm, how about:;==========================Var Setup Type Rock Field X,Y,Z, RockType, Name$ Field Model, ModelTex,State,Maxhits Field Currenthits Field ToolTip Field RequiredLevel Field Regen End Type Global AppVersion# =.5 Global Copper =1 Global Tin =2 Global Iron =3 ;==========================Game Loop Graphics3D(800,600,0,2) AppTitle("ZScape Version "+AppVersion#) ;Create Rock MyRock.rock = Rock_Create() Rock_SetType(MyRock, Copper) MyRock\Currenthits = 5 Print "Rock Created with "+MyRock\Currenthits+" Current Hits. Press any key!" WaitKey() While Not KeyDown(1) MineRock = True If MineRock Then Rock_MineRock(MyRock) MineRock = False EndIf Print "Rock Mined! Current Hits:"+MyRock\Currenthits Print "Press any key to remine, esc to exit" WaitKey() Wend End ;==========================End Game Loop ;==========================Functions Function Rock_Create.Rock() TempRock.Rock = New Rock Return TempRock End Function Function Rock_SetType(TempRock.Rock, RockType=0) TempRock\RockType = RockType Rock_UpdateRock(TempRock) End Function Function Rock_UpdateRock(TempRock.Rock) If TempRock <> Null Then Select TempRock\RockType Case 1 TempRock\Name$ = "Copper" TempRock\ToolTip$ = "This is a minable rock" TempRock\Maxhits = 5 TempRock\Regen=7 Case 2 TempRock\Name$ = "Tin" TempRock\ToolTip$ = "This is a minable rock" TempRock\Maxhits = 5 TempRock\Regen=7 Case 3 TempRock\Name$ = "Iron" TempRock\ToolTip$ = "This is a minable rock" TempRock\Maxhits = 4 TempRock\Regen=10 End Select If TempRock\Currenthits >= TempRock\Maxhits Then TempRock\State=1 If (TempRock\Currenthits/2) = TempRock\Maxhits Then TempRock\State=2 If TempRock\Currenthits =0 Then TempRock\State=3 EndIf End Function Function Rock_MineRock(TempRock.Rock) Repeat TempRock\CurrentHits = TempRock\CurrentHits - 1 Until TempRock\CurrentHits <= 0 Delay(TempRock\Regen*1000) TempRock\CurrentHits=TempRock\MaxHits End Function Not exactly sure what it is supposed to do, but guessing..... Word of advice Zach, writing cleaner code makes it easier for others to understand and help :-) |
| ||
I need help with something too... |
| ||
ANYBODY??? |
| ||
OK Ross... calm down... describe the problem either using 7331 speak or really bad english (but only if english is your native language!) Don''t bother to spell out ALL the words because it will make you look MUCH cooler! Then post your code without using forum codes OR a descriptive title... That will save everyone time since they will all know how imperative the problem is... Then insult the people that help you or ask silly questions that make little to no sense (which is MY job on this board but I digress (as I always do)) and above all: DO NOT READ ANY OF THE BLITZ HELP FILES OR COMMAND REFERENCE!!! Does that help? (heavy on the sarcasm since I know Ross knows all this!) -RZ |
| ||
Why wont this work? What you all moaning for? He DID explain the problem look! :) ______________________________________________________- .next1 Cls Print copper1\currenthits Delay(3000) Goto next1 I don't like that, looks like an endless loop to me. In fact the whole thing looks extremely confusingly convoluted. Separate your functions out and your subroutines and use some more ordered structure first. Then debugging would be easier Im sure. |
| ||
it was just an infinite loop so i could test it over and over again |