Sprite Rendering

This must be an easy question, but how to you render a sprite to the screen?

For example, shouldn’t the following code render the sprite to the center of the screen:


function draw()
sprite(“Planet Cure:Character Cat Girl”, WIDTH/2, HEIGHT/2)

yep. You’d want a “background(0, 0, 0, 255)” call in there to clear the screen, but yes - the minimal sprite draw function is to just draw the sprite. (if you do it without the background() call, you may see remnants of whatever you were running before left over on the screen…)

Is the above not working for you? (it’s “Planet Cute”, not cure, but I’m assuming that’s a transcription typo)

So, this does not appear to be working. All I ever get is a black screen.

Full Listing:


– Use this function to perform your initial setup

function setup()
print(“Hello World!”)

– This function gets called once every frame

function draw()
sprite(“Planet Cute:Character Boy”, WIDTH / 2, HEIGHT / 2)

Am I doing something wrong?

I have also tried putting a background(0,0,0,255) call before the call to sprite as well. No luck.

Also try

1)exiting Codea
2) clicking the iPad button twice (a tray of apps with data should appear)
3) click and hold the Codea icon that appears (the one in the tray not the real one)
4) click the delete

I have to do this quite often sometimes.
I believe it’s resolved in a future release.
Your code is fine.

Yes - what you have should work. bounce codify like Ipda41001 suggests, and let us know if that helps.

Killing the Codea then restarting it did solve the issue. I should have tried that knowing the iPad, but the built it sample were working so I figured that could not be the solution.

Making assumption is always the killer. Thanks for the help.