Distance

Blitz3D Forums/Blitz3D Programming/Distance

asdfasdf(Posted 2004) [#1]
I tried something different and it says memory access violation, but when I remove CheckBox() from the loop it works just fine. If you have maplet just use the test.b3d because this is basicly test with some more stuff.
P.S. And also if you can make so it will display the right player for the won thing please do so. Or if you can get it to accept more players please do so.



electronin(Posted 2004) [#2]
You don't need the "Distance" function, just use EntityDistance.


Stevie G(Posted 2004) [#3]
Not sure if this'll help but why are you using approximate distances?

you can replace all of this
Function CheckBox()

If Distance(Player,Box) < 2 Then
	RuntimeError Name$ + "Won!!!!!"
EndIf

End Function

Function Distance(Entity1,Entity2)

Entity1Pos = EntityZ(Entity1) + EntityY(Entity1) + EntityX(Entity1)

Entity2Pos = EntityZ(Enitiy2) + EntityY(Entity2) + EntityX(Entity2)

Return Entity1Pos - Entity2Pos

End Function




with ..


Function CheckBox()

If entityDistance(Player,Box) < 2 Then
	RuntimeError Name$ + "Won!!!!!"
EndIf



Also, instead of your resize mesh function just use FITMESH.

Not sure if this'll help just thought I'd point out a few things


Almo(Posted 2004) [#4]
How'd you get your code in that scroll box?


Ross C(Posted 2004) [#5]
(codebox)

(/codebox)


[] instead of ()


asdfasdf(Posted 2004) [#6]
I didn't know there was an EntityDistance!
Thanks