Text problem
Blitz3D Forums/Blitz3D Beginners Area/Text problem
| ||
Hello, still new here and still more advise, if that okay... There a problem with text when I click something, it response just fine but won't go until I click something else. So that mean if click two click-able object, the message will overlaps. My basic code for message; plant = LoadMesh("Mesh/Plant01a.3ds") ScaleMesh plant,0.04,0.04,0.04 PositionEntity plant,-5,0,2 EntityType plant,type_plant EntityRadius plant,3 EntityPickMode plant,2 -------------------------------------------------- If MouseHit(1) Then CameraPick(camera,MouseX(),MouseY()) pick = PickedEntity() EndIf If pick = plant pl = True End If If pick = 0 pl = False End If ------------------------------------ If pl = True Then Text 800,800,("Plastic plant... So you don't have to water it daily..."),1,1 Beware that it isn't whole codes. Thank you for your time reading this. EDIT: Also the sound seem repeat rapidly until I click something else too. Can someone teach me how to click something, it play sound once and message fade in few seconds. Or disappear when other item clicked? Thank you again. |
| ||
Unsure what your trouble might be, but... 2d things come last, and the page has to be flipped before things appear on the screen. Example pseudo code: Create my 3D objects Loop: Interactions with mouse/some keyboard Make motion calculations Move my 3D objects Updateworld Renderworld Draw my 2D objects and text last Flip Some other keyboard interaction type Goto Loop |
| ||
Oh! You say your sound is 'machine-gunning' ! You'll have to use a timer and a flag. Like maybe: Global sndplying(5) Global sndtim(5) Main Loop: (Used -1 to trigger a sound) If sndplying(0)=1 and abs(millisecs()-sndtim(0))>1 then (Stopsound) where the sndtim(0)>1 above is the desired duration Sndplying(0)=0 End if If sndplying(0)=-1 then sndplying(0)=1:(play your sound here) sndtim(0)=millisecs() End if There are other commands that may detect when a sound is Playing, or they might not. This method is more failsafe. Note that my example is very CRUDE. |
| ||
And the midnight millisecs()=0 bug? Use: If abs(millisecs()-var)>dur then... |
| ||
And the midnight millisecs()=0 bug? There is no such bug. What are you talking about? |
| ||
I am trying with you help, really appreciate for your help. |
| ||
Gfk: Actually it used to be at midnight in older basic(s), now it takes weeks to go back to -2147483648... and don't be naieve and sit there and wonder why your computer suddenly froze and seems to be stuck in some kind of loop because you DIDN'T use abs(timer-oldtimer)>duration of millisecs(). The number MUST tick over eventually and you have a ticking time-bomb so to speak! It ISN'T actually a bug in the language, just your program if you USE millisecs() the wrong way. A MINOR concern to be sure, but NOT to be OMITTED. I use this extender function which I tested out a bit - but you'll still tick over to 0 every 24.855 days. :D Function Millis() I%=MilliSecs() ;Trouble every 25 contiguous days If I%>=0 Then Return I% Else Return 2147483648+I% End Function So consider this: t=millisecs() while millisecs()-t<500 bla bla bla... wend Guess what happens when millisecs() goes negative? BLA BLA BLA. For a VERY LONG TIME. STUCK. Hence my 'fix' that HELPS a bit. but you still probably ought to use the abs, huh. Like this: while abs(millisecs()-t)<500 ... This is also applicable to IF's and other conditionals as well, isn't it? 'If we all must be modular programmers, then let us be accurate ones' |