Fixed a couple bugs on the object positioning code.
This commit is contained in:
parent
c5c32943e2
commit
d456b8b3b3
@ -177,6 +177,7 @@ def obj_play(sounds, soundName, playerPos, objPos):
|
|||||||
if playerPos - objPos > 9 or playerPos - objPos < -9:
|
if playerPos - objPos > 9 or playerPos - objPos < -9:
|
||||||
# The sound is out of range, so do nothing.
|
# The sound is out of range, so do nothing.
|
||||||
return
|
return
|
||||||
|
distance = playerPos - objPos
|
||||||
angle = math.radians(distance * 5)
|
angle = math.radians(distance * 5)
|
||||||
left = math.sqrt(2)/2.0 * (math.cos(angle) - math.sin(angle))
|
left = math.sqrt(2)/2.0 * (math.cos(angle) - math.sin(angle))
|
||||||
right = math.sqrt(2)/2.0 * (math.cos(angle) + math.sin(angle))
|
right = math.sqrt(2)/2.0 * (math.cos(angle) + math.sin(angle))
|
||||||
@ -196,6 +197,7 @@ def obj_update(x, playerPos, objPos):
|
|||||||
if playerPos - objPos > 9 or playerPos - objPos < -9:
|
if playerPos - objPos > 9 or playerPos - objPos < -9:
|
||||||
obj_stop(x)
|
obj_stop(x)
|
||||||
return
|
return
|
||||||
|
distance = playerPos - objPos
|
||||||
angle = math.radians(distance * 5)
|
angle = math.radians(distance * 5)
|
||||||
left = math.sqrt(2)/2.0 * (math.cos(angle) - math.sin(angle))
|
left = math.sqrt(2)/2.0 * (math.cos(angle) - math.sin(angle))
|
||||||
right = math.sqrt(2)/2.0 * (math.cos(angle) + math.sin(angle))
|
right = math.sqrt(2)/2.0 * (math.cos(angle) + math.sin(angle))
|
||||||
|
Loading…
Reference in New Issue
Block a user