Object Use - Destroy

Blitz3D Forums/Blitz3D Beginners Area/Object Use - Destroy

Merrie(Posted 2007) [#1]
I need a little help with logic please. Here is what I wish to do.

I have a potion bottle, it has 3 uses.
On left mouse click it applies 5 points to health.
It looses one of its uses.
So there would be a check to see if the three uses goes to 0 then the item would be destroyed. (Removed)

potion = 3
if left click -1
add 5 points to health
if total= < 0
then destroy.

I am pretty good with knowing what to use as far as functions and such, its putting it together Im having trouble with. Thank you!


Stevie G(Posted 2007) [#2]
You've not made it clear how the potions fit in with your game, is it 2d or 3d? Do you have multiple potions with different functionality and number of uses or just the one?

Assuming 2d and 1 potion, just don't display the potion image if potion = 0

Potion = 3

;...In main loop

If mousehit(1) and Potion > 0
      Health = Health + 5
      Potion = Potion - 1
endif



Merrie(Posted 2007) [#3]
Thank you for that example, your right I didn't tell you enough. Yes its for 2d, just the one for now just so I could see an example, thanks again!