Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

The sprite function

edited June 2012 in Questions Posts: 2

Just to make sure I'm not missing anything, the sprite function does not have a method .x or .y that outputs the current x or y value of the sprite correct? However, if i use a vec2 when assigning the sprite's x and y values, the I can use sprite.x sprite.y? I am sorry if this is a naive question, I was just expecting the sprite object to have the syntax sprite.x sprite.y or something similar to that from that the start, and documentation for the sprite function doesn't list any methods that can be called on a sprite.

Tagged:

Comments

  • Posts: 179

    Sprite is not an object in Codea, it is a function. It could more accurately be called drawSprite, as that is what the sprite function does. You could create your own class for storing the variables with a build in draw function. Let me know if you would like an example of how to do this.

  • edited June 2012 Posts: 2

    Gotcha, so basically if I want to know the x and y values for a sprite, I will need to set them a variable I can access and not get them from the sprite function. Please don't post the example, would prefer to explore on my own. Thanks for the offer though and the reply!

  • Posts: 179

    No problem, have fun exploring @liminal18.

Sign In or Register to comment.