Skip to content
Discussion options

You must be logged in to vote

I get the confusion, it got me for a while too. Bottom line is that the player's direction variable doesn't control the orientation of the player's sprite object. To do that in current 4.3, use <player_object>.sprite.flip_h = <false for left, true for right>

player-refactor branch resolves this ambiguity by instead asking you to use the PlayerChar.set_direction(new_direction: PlayerChar.DIRECTIONS) function. That looks like this...

## Sets the direction of the player's sprite and direction value
func set_direction(new_direction: PlayerChar.DIRECTIONS) -> void:
	if new_direction == DIRECTIONS.LEFT:
		direction = -1.0
		sprite.flip_h = true
		return
	direction = 1.0
	sprite.flip_h = false

A…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@legolloyd
Comment options

Answer selected by legolloyd
Comment options

You must be logged in to vote
3 replies
@legolloyd
Comment options

@legolloyd
Comment options

@DimensionWarped
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants