Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[REQUEST] Card sprite pack

beebee
edited December 2011 in Suggestions Posts: 381

May I ask to TwoLivesLeft to include standard card sprite pack in the next Codea update? I plan to make a card game requested by my kid. Current Codea's feature is enough to create such game except the lack of card sprite pack. Of course other users may utilize these sprites to create other card games. More possibilities to game genre that can be built by Codea. :)

What I mean by standard card is like the card shown in this picture (credit to this game). Just simple and common card, not too simple nor too fancy. Maybe such card images can be extracted from Windows' solitaire game resource.

Can my request be fulfilled? What do you think? TIA.

Comments

  • beebee
    edited December 2011 Posts: 381

    If it isn't too much, may I also ask for domino card sprite pack? Such as on this picture (white) and this picture (black). I have an old domino card game written in Pascal/Delphi (published here) and I'd love to convert it to Codea. :)

  • SimeonSimeon Admin Mod
    edited December 2011 Posts: 5,054

    The card pack is a really good idea - though it would also be fairly straightforward to code using the vector and sprite graphics currently available.

    Even easier was the dominoes though. I've made a Domino class you can use here:

    Dominoes

    http://twolivesleft.com/Codea/Projects/Dominoes.codea

    Has the following features

    -- Create a domino
    -- First argument is number of dots on top, second is number of dots on bottom
    -- Can be 0 to 6
    domino = Domino( 2, 6 ) 
    
    -- Dominos can be scaled (this does not use the scale() function, so looks nice)
    -- Default domino size is 100x200 pixels (defaults scale = 1.0)
    domino.scale = 0.6
    
    -- Dominos can be positioned and rotated
    domino.position = vec2( WIDTH/2, HEIGHT/2 )
    domino.angle = 45
    
    -- Dominoes are drawn as follows
    domino:draw()
    
    -- Domino colours are configured (default white with black dots)
    domino.backgroundColor = color( 40, 40, 40, 255 )
    domino.dotColor = color( 255, 255, 255, 200 )
    

    The sample app just creates 9 random dominoes.

    Dominoes Sample

  • beebee
    edited December 2011 Posts: 381

    About domino, I knew it can be drawn instead of still image. I even thought I will make it myself since it's not difficult. But I believe drawn card is slow, especially if needed to show many cards, and less polished than bitmap card. Anyway, thanks for the class @simeon, so I don't need to write one by myself. :D

    About the other card (what is that card name by the way?), though it's possible to draw it, I believe it won't be pretty, especially the royal cards. And will be much slower as there are many details that need to be drawn. I think the best approach for this card is bitmap sprite. So, will you provide the card sprite pack on the next Codea update? :)

  • beebee
    edited December 2011 Posts: 381

    Just got my iPad. Tried @simeon's domino class. Modified it a bit, to my taste. It turned out quite fast, even when drawing many cards (40 cards), on my iPad 1. Their look isn't that bad, pretty much acceptable. So, I'm quite satisfied with drawn domino card. Thank you, Simeon. :)

  • beebee
    Posts: 381

    My little modification is posted here: http://beepost.posterous.com/codea-domino-card

  • BortelsBortels Mod
    Posts: 1,557
    If we had SVG support, these would be ideal:

    http://code.google.com/p/vectorized-playing-cards/

    Having said that, it strikes me that a spritepack with rasterized versions of them would be nearly as nice, and a lot easier to use. I suggest larger sizes - we can always scale them down if need be...
  • beebee
    edited December 2011 Posts: 381
    @Bortels: Those cards look very nice indeed. I think TwoLivesLeft need to use it to create the rasterized version of them in 3 sizes (small, medium, large) and make them as Codea's card sprite pack. Or at least, one size as you suggested. And include them in the next update. I thought it wouldn't be too difficult. :)

    BTW, I just made another modification to the domino card class. Add a 'closed' property for closed card and a few adjustments here and there. Will post it on posterous soon.
  • beebee
    edited December 2011 Posts: 381

    Domino class card got updated. You may look at it on my posterous site here:

    [Codea] Domino Card - update #1 (Dec 11, 2011).

    What's new:

    • Class refactoring. It's now more flexible as almost any elements of the card is customizable.
    • Add 'closed' property for closed card (where card's value isn't displayed).
    • Closed card shows backside card ornament. Currently only red-blue stripes available.
    • Add basic touch support for card movement, but still very basic.

    Issues:

    • Touch support is still glitchy and need more works. If you move your finger too fast, you will "loose" the card. :(
    • Still unable to detect rotated card correctly as if it isn't rotated. I still have some issues with vec2 type to handle rotation. Please look at the touched()function of Domino class.
    • z-order drawing is still incorrect, touching or moving a card should bring it to top. I need to learn more about how to sort a table based on its item value. Please look at the sortCard()function on main program file.

    Any help to make this card class work better, especially on the touch support, is very much appreciated since I can't promise I will be able to continue to work on it during work-days. This class will be very useful when the requested card sprite pack got fulfilled. :)

    By the way... while working on touch support of this domino card made me want the built-in gesture API. Having to code our own gesture detection (over and over again as almost any screen objects eventually will need it to some points) seems to be too much and should be unnecessary for a tool like Codea. Detecting basic/common touches and gestures e.g. tap, double-tap, tap-hold, touch-drag, etc. should be provided out of the box. Though advance users may override them to made their own customized version using low-level APIs.

  • beebee
    edited December 2011 Posts: 381

    It seems that Markdown syntax is not working again. Especially for list and inline code. I got to do it manually using HTML syntax. :(

  • SimeonSimeon Admin Mod
    Posts: 5,054

    Weird it should be working. Unless it got disabled again.

    Testing code block
    
  • beebee
    edited December 2011 Posts: 381

    new paragraph

    • test asterisk list
    • another item

    • test hyphen list

    • another item

    test inline codenow

    test block quote

    formatted text: italic bold

    --

    Ok... seems to work again now. Thanks @simeon. :)

  • BortelsBortels Mod
    Posts: 1,557

    Here are the cards in PNG with alpha (a bit big, but meh - I don't know how well they'll scale down...)

    http://code.google.com/p/vector-playing-cards/

  • beebee
    Posts: 381

    A quick solution is TwoLivesLeft simply exports the available SVG drawing into alpha-PNG images and pack them as a new sprite pack. Fast and simple. No need to code and test new features. Perhaps ImageMagick could make the process even faster and easier. ;)

Sign In or Register to comment.