Jump to content

drawing a design of coins from an xml file or json file.


ysrikanth2011
 Share

Recommended Posts

Hello,

 

I am trying to draw a design for coins that the player collects like in super mario game. The coins design might have some fixed number like 8 designs. I want to draw these based on some random number generation and picking up one design .

 

I am using a paralaxer background and moving the coins. After the coins have gone behind the screen I want to draw a new design. 

 

I don't know how to do this as I am new to game programming, my friend suggested me a possible way might be to include an xml file ,which contains like 0 ,1's you draw where there are 1's and leave where there are 0's . I am using cocos2d-html5 for programming. I don't think it is a better idea to use text files to achieve this ,Is it ?

 

If you have any better idea ,please tell me.

 

Any code samples or weblinks(only in javascript) are greatly appreciated.

 

I am posting a sample design ,how I want it to be., like this I am going to have several designs.

post-938-0-91770400-1364454457.png

post-938-0-79014500-1364454475.png

Link to comment
Share on other sites

If you're using TMX maps it might be easy to just make an Object layer where the coin group would appear.

Then in your code look for all the 'coin group' objects and make new instances of the coin group, with a random design parsed into the constructor.

 

Here's a good tutorial for Cocos2d-x, which is mostly applicable to Cocos2d-html5.

 

http://www.raywenderlich.com/1163/how-to-make-a-tile-based-game-with-cocos2d

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...