I have a question

Blitz3D Forums/Blitz3D Beginners Area/I have a question

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You would loop through the collisions that the player's entity has made since the last updateworld command like this:


a really basic method is as follows:
type TreeObject

field EntityHandle
field Wood
end type

for ColIndex=1 to CountCollisions(PlayerEntity)
     ColEntity=CollisionEntity(PlayerEntity,ColIndex)
     FoundTree=false
     For Tree.TreeObject=each TreeObject
          If Tree\EntityHandle=ColEntity then FoundTree=true:exit 
     next
     If FoundTree=true then Tree\Wood=Tree\Wood-1:PlayerWood=PlayerWood+1
next



Then after your renderworld but before your flip you might do something like this:

For Tree.TreeObject=each TreeObject
    CameraProject Camera,EntityX(Tree\EntityHandle),EntityY(Tree\EntityHandle)+OffsetY#+EntityZ(Tree\EntityHandle)
   Text Projectedx(),Projectedy(),"Wood:"+Str(Tree\Wood)
next 



The code posted there should give you ideas hopefully. There are 1001 ways of doing this and that is just one of them.