Skip to content

Instantly share code, notes, and snippets.

@blenderdeluxe
Last active April 9, 2017 19:47
Show Gist options
  • Save blenderdeluxe/bb806d285e09756b3dcce5945dce15a6 to your computer and use it in GitHub Desktop.
Save blenderdeluxe/bb806d285e09756b3dcce5945dce15a6 to your computer and use it in GitHub Desktop.
2D Sprites BGE
import bge
cont = bge.logic.getCurrentController()
own = cont.owner
if own['currentFrame'] <= own['maxFrame']:
own.replaceMesh(own['meshName'] + str(own['currentFrame']), 1, 0)
own['name'] = own['meshName'] + str(own['currentFrame'])
own['currentFrame'] += 1
if own['currentFrame'] > own['maxFrame']:
own['currentFrame'] = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment