Real Software Forums

Card Animations
Page 1 of 1

Author:  ccfman2004 [ Fri Aug 26, 2011 8:39 pm ]
Post subject:  Card Animations

I am making a custom card game for Windows/Mac based on the Yu-Gi-Oh card game. I need help making the cards move from one location on the field to another. I have see a few card games made from Real Basic that look very good, but since they are not open source, its hard to do this myself. The field will have 30 card positions plus each player has their own hand that can have from 0 to any number of cards in it. There will be no dragging card manually. It will all be automatic. Plus there will be a card definition spot on the screen that will show what the card can do when you hover over the card in your hand or the field for a few seconds. I want the card on this part to be able to flip from one card to another. Plus the cards on the field need to be flippable with a flip animation.

I will also have a card library that will show all possible cards in the game. I will be showing 50 cards per page and the those small pics need to flip in sort of a wave pattern when going to the next or previous page. This section will also have the card definition section in it to.

I have looked at the DragPics example, but I find the comments not explaining enough for me. I need to know what each function is doing and how it does it. Since there will be no manual dragging in my game, it might be easier.

I don't know whether it would be better to have one big canvas for the filed or one separate canvas for each possible card. Also with each players hand, when you hover over a card it needs to move up slightly and go back to its original position when the cursor is off the card. Also the cards need to go closer together as you add more cards to the hand and go further apart when you remove card from the hand.

Fo now I just want to get the card library section done first as it should be the easiest to do. For the card library, I don't know whether I should use one big canvas or 50 small canvases for each card.

I am mainly doing this project as a learning experience and to have a Mac version of the game. There are no Yu-Gi-Oh! type games for the Mac. Yes I want this to work on Windows too.

Any help will be appreciated. For your information, I mainly learn by example code.

For the card library and playing field, every position except the hand will be a fixed location. The hand will have a general local but will be changing based on the number of cards in each hand.

On the field, when cards are placed on the the field, destroyed or activated, there will be small animation to go along with it.

If someone knows of an open sourced card game that does not use Cards.dll, and has some of the stuff I am trying to do, please let me know.

Author:  noisome [ Fri Aug 26, 2011 11:25 pm ]
Post subject:  Re: Card Animations

Howdy there.

I appreciate what you are trying to do. I know of no good RealStudio card game interface that's open source, so what I have in my list are all open source C++ games (and Java).

There are more, but that should give you a general reference for some things you are trying to do.

Author:  ccfman2004 [ Fri Aug 26, 2011 11:30 pm ]
Post subject:  Re: Card Animations

I don't know anything about C or java. Never even tried to learn it. BASIC is all I know and love.

Author:  kermit [ Sat Aug 27, 2011 3:30 am ]
Post subject:  Re: Card Animations

I think you would have been best off with the sprite surface, (which RB have dropped).
(There is an external class)

Perhaps look into Open GL?

But ignoring the 'flip' animation for the moment, if you need to put things on screen at specific places and perhaps move them about under their own steam, have a look at this post which discusses how to do it using nothing more than one canvas and a few pictures on top:


Author:  ccfman2004 [ Sat Aug 27, 2011 11:19 am ]
Post subject:  Re: Card Animations

I definitely don't want to be using Sprites since support has been dropped.

Do I really need to use OpenGL since I am only using 2D graphics? I am not interested in having to learn a different language.

The example does help a little bit, but I need the objects to be clickable and trackable.

Author:  kermit [ Sat Aug 27, 2011 11:49 am ]
Post subject:  Re: Card Animations

clickable and trackable.

I'm afraid I don't have a complete app where everything you need already exists and all you need to do is change the graphics.

To determine which item is clicked, one way to do it is to have an array of objects, each of which knows its position.
A click on the canvas triggers a search of the objects, checking to see if the click occurs inside of the rectangle it occupies.
You store the objects in a list where the first is at the back, and the last is the one on the top.
(The drawing order)
You search through the list and find the last item in the list that would have got the click.
Thats the selected one.
Not sure what you mean about trackable.

If you want to drag things about have a look at alex restrepo's classes: he has an example for little note windows all done in a canvas.

Author:  ccfman2004 [ Sat Aug 27, 2011 12:17 pm ]
Post subject:  Re: Card Animations

Alex Restrepo's GridCanvas looks promising. I'll have to modify it to fit my slightly non-standard grid.

EDIT: His GridCanvas might be just the thing I need for the Card Library portion of the game. Not too sure about the actual dueling part.

Author:  kendoll [ Sun Sep 04, 2011 1:49 am ]
Post subject:  Re: Card Animations

A canvas is usually enough for most 2D drawing, especially if it is not particularly complex. Definitely only use one large canvas for the playing area; you will likely encounter visual issues if you do not.

Also, I would suggest getting your game working without any animation first, then add in the necessary animations once everything is working. Visually they are nice to have, but are not usually critical for enjoyment of board and card games.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group