0 votes

All I'm trying to do i position a popup in my game. After so much frustration, I came to ask here. Why can't I position my popup above the x origin line and have it also above that line in game?? I'm so perplexed. The popup stops short of going above that line no matter where I position it.

Edit: it also stops short of going left of the Y-origin?

in Engine by (24 points)

1 Answer

0 votes

is this a 3D or a 2D game? Is the pop up animated?
Sometimes, you have to make the mesh or the popup's properties be local to its scene, so that when its instanced whatever coords it is supposed to be at it will go to, otherwise it might be going to say 0,0,0 or 0,0 in a 2d game. This should help if the pop up is animated.

by (56 points)

It is a 2D game. The popup is not animated, and I make it appear when the player is within a certain distance from a sprite, full code here on the popup:

extends Popup

var player
var Fish

func _ready():
    Fish = get_tree().root.get_node("/root/World/Fish")
    player = get_tree().root.get_node("/root/World/player")

func _process(delta):
    var player_relative_position = player.position - Fish.position
    if player_relative_position.length() <= 200 && Input.is_action_just_pressed("Talk"):
        popup()

So, pretty simple. I've tried putting it under a control node, but same result no matter where I position everything in the editor: it doesn't want to go past (0,0) to anywhere negative when I run the game.

I'm assuming I'll just have to position it in code? Though it still wouldn't make sense to me...

to figure out exactly what your problem is we should have the function print the location of the fish and the location of the player.
Also try instead of playing with the translation of the object to play with the objects offset instead.

I haven't much experience with 2D, I only do 3D. But I remember having to change offset instead of translation once.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.