njohn
New Member
Posts: 6
|
Post by njohn on Apr 2, 2014 12:11:34 GMT -8
Hi,
I'm trying to understand a bit about asset creation. The following points/questions are based on the "walk" example:
How was the walk_asset.h file created? I.e. what was the exact invocation of gd2asset? Did you supply 8 separate 32x32 images or a single image with animation frames in it? If so, how to you specify numbers cells/cell size?
Also, what's the use case of the WALK_SHAPE entry?
Thanks in advance.
|
|
|
Post by jamesbowman on Apr 2, 2014 19:03:34 GMT -8
I used Python scripts for anything more complicated than a single image. So for "walk" the script is: import Image import gameduino2 as gd2
class Walk(gd2.prep.AssetBin):
def addall(self): walk = gd2.prep.split(32, 32, Image.open("../assets/walk.png"))[1:] self.load_handle("WALK", walk, gd2.ARGB1555)
if __name__ == '__main__': Walk().make()
"walk.png" is this: Regarding WALK_SHAPE, this was a bit of an experiment. Code in Nightstrike uses _SHAPE so it can set up the sprites without having any sizes hard-coded.
|
|
bubu
Junior Member
Posts: 17
|
Post by bubu on Apr 2, 2014 21:40:11 GMT -8
If I wanted to get the results of that "split script" in a output asset file instead of a header file, would it be correct to to set self.asset_file to the file name I want to recieve prior to calling make()?
|
|
njohn
New Member
Posts: 6
|
Post by njohn on Apr 3, 2014 0:46:48 GMT -8
I used Python scripts for anything more complicated than a single image. So for "walk" the script is: import Image import gameduino2 as gd2
class Walk(gd2.prep.AssetBin):
def addall(self): walk = gd2.prep.split(32, 32, Image.open("../assets/walk.png"))[1:] self.load_handle("WALK", walk, gd2.ARGB1555)
if __name__ == '__main__': Walk().make()
"walk.png" is this: Regarding WALK_SHAPE, this was a bit of an experiment. Code in Nightstrike uses _SHAPE so it can set up the sprites without having any sizes hard-coded. Thanks, that helps a lot...
|
|
bubu
Junior Member
Posts: 17
|
Post by bubu on Jun 3, 2014 23:07:10 GMT -8
import Image import gameduino2 as gd2
class Walk(gd2.prep.AssetBin):
def addall(self): walk = gd2.prep.split(32, 32, Image.open("../assets/walk.png"))[1:] self.load_handle("WALK", walk, gd2.ARGB1555)
if __name__ == '__main__': Walk().make()
jamesbowman: I still have problems when trying to mix differnt types of assets with the Cells created by the example above. Can you expand that script by let´s say adding a sound sample and a jpeg picture in the same asset file, please?
|
|