+1 vote

Hello, so, i started using Godot a few Days ago, did a Test Project and now wanted to make my real Project with my Idea i had before, now i used some Code from the Q&A, did some small Edits and for some Reason my Player Sprites arent just showing in the Test Player.

Heres the Code:

extends KinematicBody2D

export (int) var speed = 200

const GRAVITY = 100

var movement = Vector2()
var velocity = Vector2()

func _physics_process(delta):
    get_input()
velocity = move_and_slide(velocity)

func get_input():
rotation = get_global_mouse_position().angle_to_point(position)

velocity = Vector2()
if Input.is_action_pressed("down"):
    velocity = Vector2(-speed, 0).rotated(rotation)
if Input.is_action_pressed("up"):
    velocity = Vector2(speed, 0).rotated(rotation)

func _process(delta): 
movement.x = 0

if is_on_ceiling() or is_on_floor():
    movement.y= 0

if movement.y < 200:
    movement.y = movement.y + GRAVITY * delta

And here some Screenshots:
General Overview
Collision Shape, Not shown either in Play Test
Sprite
Player

The Mistake is probably incredibly stupid but i just dont find anything on it.

Godot version v3.4.2
in Engine by (20 points)

if I'm not mistaken. Check "animationplayer". The error is there.

1 Answer

+1 vote

There are a few possible reasons and I am afraid looking at what we can see here I dont think we can tell you exactly. Its worth noting that the collision shape shouldnt show when you actually run the scene only in the editor. You can make it show on screen by making a change in the options but as standard collision shapes dont show when you run the game.

One possibility for your sprite not showing is in the editor where you have the section called inspector you will see nodes and next too them one of the icons is a little eye. If the eye is blank it has been hidden and if it is full it shows. You could try clicking on this.

Another possibility is that the sprite has not actually had an image added to it. In the inspector there will be a section called "frames" if it is an animated sprite and "texture" if it is a standard sprite. You need to drag and drop a .png or .jpg picture into the texture of double click on the frames and add all the animations if it is a animated sprite. Without that it will just be a blank sprite.

Another possibility is in the inspector there is a section called "visibility" under canvas item. The visible option has to be selected on here.

If its not one of these it will be something more complex and I dont think we have enough info here to help you.

by (1,635 points)
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.