#Lerp() not working on normal sprite2d node

1 messages · Page 1 of 1 (latest)

scenic drift
#

Hello everyone,
I just joined this server and I have a questiion already.
I started a few weeks ago with godot and I decided to make a game called "pizza clicker" (I know its a cookie clicker nock off and no hate its just for fun.
What I am trying to do now is every time you click on the big pizza, a small pizza will appear in the pizza counter box and will slide to the border of the box. The small pizza is a Sprite2D and I am trying to do this with the lerp() function, however, somehow it says: "Invalid call. Nonexistent function 'lerp' in base 'Sprite2D (SmallPizza.gd)'.". I know the problem is not the editor because when I try to creeate a new scene with a new Sprite2D, it just works fine.

When I try to do self.lerp(1,2,3) the editor gives me an error because "function lerp() is not found in base self." as shown in the screenshot.

#

So the question is: why do I get this error when this is just a normal sprite2d and how to fix it?

scenic drift
#

Also, when I try to recreate the node, it is the same issue

delicate pilot
#

lerp is a global method, which means it's not tied to a single class; all scripts can access it (along with the rest of the methods and properties of @GlobalScope in the docs class reference), so you shouldn't need to do self.lerp(1, 2, 3). You can just do lerp(1, 2, 3). This also might be a good instance to use a Tween though