[resolved]My character don't move

OgamaruOgamaru Posts: 3Member
edited February 15 in 2D

there is few error that i don't understand


Tags :

Comments

  • OgamaruOgamaru Posts: 3Member

    nothing happen when i'm pressing left or right

  • cyberealitycybereality Posts: 561Member
    edited February 14

    Well, to start with vel is a Vector2 and then you are setting it to equal speed, which is a number, so that doesn't make sense (and even if the types were the same, that wouldn't make sense).

    So you probably want to remove the line "vel = speed". Probably the best thing would be to change "is_action_just_pressed" to "is_action_pressed" (so it happens every frame rather than just once). And at the start of "_process" set "vel = Vector2.ZERO".

    See if that helps.

  • MegalomaniakMegalomaniak Posts: 1,835Admin

    Theres also the odd space on line 21 between vel. and x.

  • cyberealitycybereality Posts: 561Member

    @Megalomaniak said:
    Theres also the odd space on line 21 between vel. and x.

    Good eye. I missed that.

  • OgamaruOgamaru Posts: 3Member

    @cybereality said:
    Well, to start with vel is a Vector2 and then you are setting it to equal speed, which is a number, so that doesn't make sense (and even if the types were the same, that wouldn't make sense).

    So you probably want to remove the line "vel = speed". Probably the best thing would be to change "is_action_just_pressed" to "is_action_pressed" (so it happens every frame rather than just once). And at the start of "_process" set "vel = Vector2.ZERO".

    See if that helps.

    thx it helped a lot

  • cyberealitycybereality Posts: 561Member

    Cool. So happy to help.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file