Really basic HELP! lol
Blitz3D Forums/Blitz3D Beginners Area/Really basic HELP! lol
| ||
Sorry to be asking what is probably a really silly question with a blatantly obvious answer... but I've been away from coding for a while & I'm now trying to do a really basic little visualisation that uses a `portal` that I can't seem to get working properly... I know the problem is probably so obvious that I'm almost afraid to ask lol But... this works... ie: when the player comes into contact with the portal... one scenery mesh is `hidden` & another is `shown`... If EntityCollided(player,3) HideEntity mesh ShowEntity mesh2 EndIf My problem starts when I add a `switch` so that when the player re-collides with the `portal` the scenery meshes switch back... I've added a global named `location` with a value of either 0 or 1... set by the collision with the portal... ie: If location=0 If EntityCollided(player,3) HideEntity mesh ShowEntity mesh2 location=1 EndIf EndIf If location=1 If EntityCollided(player,3) HideEntity mesh2 ShowEntity mesh location=0 EndIf EndIf For some reason absolutely nothing happens when the player collides with the `portal` now?... could someone please tell me why :) Thanks BTW... I set `location=0` in the initialisation, so it does have an initial value. |
| ||
When location=0 you're swapping meshes and then set location=1 which is then immediately caught by the next if statement which switches the meshes back! Use: If location ; Location = 1 Else ; Location = 0 EndIf |
| ||
Of course it is! lol... thanks big10p :)... I'm not sure I understand your solution though? |
| ||
I just mean do something like the following, so only one block of code gets executed each pass:If location If EntityCollided(player,3) HideEntity mesh2 ShowEntity mesh location=0 EndIf Else If EntityCollided(player,3) HideEntity mesh ShowEntity mesh2 location=1 EndIf EndIf |
| ||
Ah!!!!!!!... a BIG thanks big10p :)... I see what you mean now! Cheers! I'd temporarily fixed it by assigning a totally different value to `location`until the player moved away from the portal... then I re-assigned it to suit whichever location I was actually in! lol... amateurish I know... but it worked as a `quick fix` ;) lol... it would have got complicated when I added more locations though! Thanks again :) Paul |
| ||
No probs. ;) |
| ||
Some cool stuff you got there on your website Quantum :o) Talented guy. |
| ||
Thank you Ross :) *blushes* |
| ||
Hi, Just a quick tip. Write a title thats relevant to your question. Generally 'Really basic HELP! lol' arn't acceptable in forums. :) |
| ||
`Really basic HELP!` referred to the fact the I was asking a `really basic` question about `basic`... infact, a question I was almost too embarrased to ask because I should have known the answer... having been writing programs probably since before you were even an itch in your daddy's pants! lol But point taken :) |