Pushing furniture around

Blitz3D Forums/Blitz3D Programming/Pushing furniture around

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.

Function ControlP1()

xinc# = (KeyDown(205) - KeyDown(203)) * 0.1
zinc# = (KeyDown(200) - KeyDown(208)) * 0.1

p1\xvel# = (p1\xvel# + xinc#) * 0.7
p1\zvel# = (p1\zvel# + zinc#) * 0.7

TranslateEntity p1\entity,p1\xvel#,p1\yvel#,p1\zvel#

For i = 1 To CountCollisions(p1\entity)
	For b.box = Each box
		If CollisionEntity(p1\entity,i) = b\entity
			b\xvel# = p1\xvel# * Abs(CollisionNX(p1\entity,i))
			b\zvel# = p1\zvel# * Abs(CollisionNZ(p1\entity,i))
		End If
	Next
Next

End Function


Function UpdateBoxes()

For b.box = Each box

	TranslateEntity b\entity,b\xvel#,b\yvel#,b\zvel#

	x# = EntityX(b\entity)
	y# = EntityY(b\entity)
	z# = EntityZ(b\entity)
	
	b\xvel# = x - b\px
	b\yvel# = y - b\py
	b\zvel# = z - b\pz

	b\xvel# = (b\xvel#) * 0.7
	b\yvel# = (b\yvel# - 0.1) * 0.5
	b\zvel# = (b\zvel#) * 0.7
	
	b\px# = EntityX(b\entity)
	b\py# = EntityY(b\entity)
	b\pz# = EntityZ(b\entity)
	
Next

End Function


taken from my little fun project :P