cbillows

  • Apr 7, 2023
  • Joined Jul 13, 2022
  • 0 best answers
  • If you do a change_scene is the transparency lost?

    In my demo I want to have a label pop up that says you won. So I have an IF statement that says if monsters < 1 then:

    get_tree().change_scene("res://UI/EndScreen.tscn")

    This works fine except that the Control, MarginContainer, and CenterContainer (I've tried all three) nodes all have a dark grey background that covers the screen framing the text. I don't have any theme set or any colors picked. I simply want the text to be posted on the screen that says you've won and am using those containers to center the message.

    Any ideas how to fix this? I'm using version 3.4.3.

  • Megalomaniak
    Okay, your reply got me going in the right direction. I found the following video to help with custom themes.

    It solves part of my issue. The scene still has a background to it.

  • Megalomaniak

    Any suggested tutorials on how to do that? I have tried to create a custom theme and the new interface is not making any sense to me.

  • In my demo I want to have a message pop up that says you won. So I have an IF statement that says if monsters < 1 then:

    get_tree().change_scene("res://UI/EndScreen.tscn")

    This works fine except that the MarginContainer or CenterContainer (I've tried both) both have a dark grey background that covers the screen framing the text. I don't have any theme set or any colors picked. I simply want the text to be posted on the screen that says you've won and am using those containers to center the message.

    Any ideas how to fix this? I'm using version 3.4.3.

    • cybereality Thank you for your help. Your answers and links gave me the info I needed to learn enough to get to the next problem. :-)

    • cybereality Thank you for that suggestion. I remember experimenting with child nodes following the player one time. I'll do more research and figure out how to do that. The game design I'm following (its a an old Atari 2600 game) had the items like the Sword be persistent that were carried around with you with no change to the sprites.

      But is there an easy way to reference the players coordinates in a child node?

    • Hi everyone,

      I'm new here and new to Godot. I've done a couple of basic tutorials. The last being Heartbeast's ARPG Youtube series. I am wanting to add things to this demo to start becoming more familiar with programming and the engine.

      What I want to do is have a Sword (an Areas2D scene with sprite and collision2D) on the map and have my player run into it and then pick up the item. I've been able to run into it and trigger an output that proves this, but want the item when triggered to follow the player. I know my script pushes the Sword towards 0,0 when I touch it, but is there not an easy way to tell it to push it towards the player's coordinates?

      Here is the script:

      extends Area2D
      
      onready var sword_pos = $SwordImage
      
      func _on_Sword_body_entered(body):
      	print("sword touched")
      	var speed = 5 # Change this to increase it to more units/second
      	
      	position = position.move_toward(Vector2(0,0), speed)

      Thanks in advance!

      Chris

      • Yes, you can get the player node by the node path. For example (this may not work, depending on where your player is in the tree).

        var player = get_node(".../Player")
        position = position.move_toward(player.position, speed)

        See here:
        https://kidscancode.org/godot_recipes/basics/getting_nodes/