Get Position Y of Static Sprite

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pixelinkmedia

I am trying to make a page scrolling effect using a sprite as some written text and images. It’s just one sprite.

I can move the static sprite up/down fine

But, i am trying to get the position of the top of the sprite so, if it is says -100 pos
It won’t scroll up anymore.

Here is my code, but the “if $Sprite.get_position_in_parent() == -100:”
line doesn’t work

func _on_Up_pressed():
	if $Sprite.get_position_in_parent() == -100:
		#nothing
		pass
	else:
		$Sprite.move_local_y(-20)
:bust_in_silhouette: Reply From: pixelinkmedia

I figured it out…

func _on_Up_pressed():
	if $Sprite.position.y >= 205:
		$Sprite.move_local_y(-20)
	else:
		#nothing
		pass