Help! Tell me what's happening here!

Blitz3D Forums/Blitz3D Programming/Help! Tell me what's happening here!

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.

Okay - sorry for not putting relevant code here in the first place - here's the actual 'special water exit' function that sends the rotations out of synch. Dynaman - if it is the tweening what can I do
to get this working right?

; ------------------------
; ALLOWS TOMMY TO JUMP FROM WATER
; ------------------------
FUNCTION special_exit_routine ()
;---------------
IF exit_switch=-1 ; this is set IF near 'Water_door' AND the up key is being pressed FOR more than a 1/4 second

	;hide the water collison mesh so collisions are off
	M_trady#=0.89 ;reset collision ellipses to upright
	M_tradx#=0.50
	enemy_bounce=0
	bounce_up#=0
	bounce_boost#=0
	jump_boost#=0


	HIDEENTITY water_bound
	exitposy#=posy#
	exit_switch=-2
	IF KEYDOWN(left) OR KEYDOWN(right) ; NOT moving fORward or backwards
		anim_trig=20 ;set up FOR anims below = leap forward
	ELSE
		anim_trig=25 ; = leap up
	ENDIF
ENDIF
IF exit_switch=-2
	exittime=exittime+3
	trans_y#=0
ENDIF
IF exittime=>90
	exittime=0
	environment=1 ; switch TO land
	exit_switch=0
	IF KEYDOWN(left) OR KEYDOWN(right)
		anim_trig=1 ; RUN
	ELSE
		anim_trig=20 ; STAND
	ENDIF
ENDIF
temp_posy#=((SIN(exittime)*3)+ exitposy#)
;------------------
IF environment = -1
	IF exittime=60
		IF KEYDOWN(left) OR KEYDOWN(right)
			anim_trig=30
		ELSE
			anim_trig=35
		ENDIF
	ENDIF

	IF anim_trig=20
		anim_trig=0
		ANIMATE tommy,3,0.35,water_leap_forward,15

	ENDIF

	IF anim_trig=25
		anim_trig=0
		ANIMATE tommy,3,0.35,water_leap_up,15

	ENDIF

	IF anim_trig=30
		anim_trig=0
		ANIMATE tommy,3,0.35,jump_run_anim2,8
		ENTITYRADIUS player, 0.49,0.79
	ENDIF
	IF anim_trig=35
		anim_trig=0
		ANIMATE tommy,3,0.35,jump_up_anim2,8
		ENTITYRADIUS player, 0.49,0.79
	ENDIF



	;-----------------------------------------------------------
	;-----------------
	; turn the player
	;------------------

	IF turn_tom="right"
		IF NOT roty  =-90
			turn=turn
			TURNENTITY targetnode,0,turn,0

		ENDIF
	ENDIF
	IF turn_tom="left"
		IF NOT roty = 90

			TURNENTITY targetnode,0,turn,0

		ENDIF
	ENDIF
	
	;-----------------------------------------------------------

	IF  KEYDOWN( right ); RIGHT. The 'D' AND 'CURSOR RIGHT' keys.
		;IF roty=90 ;remember i've rotated the tommy model To -90 To make him stand sideways
			;turn_tom="right"
			;turn=6
		;ELSE
			;turn=turn
		;ENDIF
		move_x#=move_x#+0.002 * speedup#
		IF move_x#=>0.012 * speedup#
			move_x#=0.012 * speedup#
		ENDIF

	ENDIF
	;-----------------------------------------------------------
	IF  KEYDOWN( left ) ;LEFT. The 'A' AND 'CURSOR LEFT' keys.
		;IF roty=90 ;remember i've rotated the tommy model To -90 To make him stand sideways
			;turn_tom="left"
			;turn=6
		;ELSE
			;turn=turn
		;ENDIF
		move_x#=move_x#-0.002 * speedup#
		IF move_x#=< -0.012* speedup#
			move_x#=-0.012* speedup#
		ENDIF
	ELSE
	ENDIF

	;----------------------------

   roty=ENTITYYAW(targetnode) ; grab this value because I   need it FOR the 'X' bob effect at the bottom of FUNCTION


	if EntityPitch(targetnode,true) < 0
		dturnx#=1
		tempturn#=EntityPitch(targetnode,true)+dturnx#
		bobturn#=tempturn#	
	endif

	if EntityPitch(targetnode,true) > 0
		dturnx#=1
		tempturn#=EntityPitch(targetnode,true)-dturnx#
		bobturn#=tempturn#	
	endif

	if EntityPitch(targetnode,true) > -1 and  EntityPitch(targetnode,true) < 1 then bobturn#=0


	;-------------------------------------------------------------------
	ROTATEENTITY targetnode,bobturn#,roty,0 ,true ; Roty is grabbed from the turn section above
	TRANSLATEENTITY player,((move_x#+ jumpboost#) * player_move_speed#) , trans_y#, 0
	POSITIONENTITY player_camera, 0, (camypos#+3.24),campos#, FALSE
	;-------------------------------------------------------------------
	posx#=ENTITYX (player)
	posy#=ENTITYY(player)
	posz#=ENTITYZ(player) ;we don't want tommy To be off his zero z
	rotx=ENTITYPITCH(player)
	roty=ENTITYYAW(targetnode)
	rotz=ENTITYROLL(player)
	;If posz#<>0
	POSITIONENTITY player, posx#, temp_posy#, 0 ; KEEP the Z at ZERO!!
	;EndIf
ENDIF
;------------------
FLUSHKEYS




;---------------------------
do_bullets()
player_recoils()
;---------------------------

;debuglog " Special rotations Y :  " + roty

END FUNCTION