(1) is how I get the game to display something at all.
(2) is a SIMPLE composite that already doesn't show anything.
(3) is how I want it to be, obviously it doesn't work either.
My guess is that SpriteManager() doesn't work with composites, but that would baffle me since im.Composite() can, at least in Ren'py code, used just like a file name in image declarations.
I know I can use animations I declared using normal Ren'py script in sprites, like this:
Code: Select all
image blinkball:
"gfx/ball_0.png"
pause 0.1
"gfx/ball_1.png"
pause 0.1
Code: Select all
init python:
class Game(object):
class Sprite(object):
def __init__(self, name):
self.name = name
class ShipClass(Sprite):
allships = 'shmup/gfx/ships.png'
shipcolor1 = 'shmup/gfx/shipcolor1.png'
shipcolor2 = 'shmup/gfx/shipcolor2.png'
def __init__(self, name, sprite, color, speed):
self.speed = speed
# self.sprite = allships #(1)
self.sprite = im.Composite( #(2)
(0, 0),
(0, 0), self.allships)
# self.sprite = im.Composite( #(3)
# (0, 0),
# (0, 0), im.Crop(self.allships, (sprite*66, 0, 66, 64)),
# (0, 0), im.MatrixColor(im.Crop(self.shipcolor1, (sprite*66, 0, 66, 64)), im.matrix.tint(color[0], color[1], color[2])))
Sprite.__init__(name)
# initiate spritemanager:
def __init__(self):
self.ships = SpriteManager()
self.ship_sprites = [ ]
self.ship_list = [ ]
self.ship_list.append(self.ShipClass('Viper', 0, (1.0, 0.5, 0.0), 5))
self.ship_sprites.append(self.ships.create(self.ship_list[0].sprite))
def showships(self):
renpy.show('ship', what=self.ships)
self.ship_list[0].x = 0.5
self.ship_list[0].y = 0.5
define e = Character('Eileen', color="#c8ffc8")
# The game starts here.
label start:
$ shmup = Game()
$ shmup.showships()
e "You've created a new Ren'Py game."