realbasic-games
[Top] [All Lists]

Re: [Ann] Making a Card Game with Cards.dll

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: [Ann] Making a Card Game with Cards.dll
From: Barry Traver <rb at ix dot netcom dot com>
Date: Wed, 16 Nov 2005 13:31:14 -0500
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <4379669E dot 3070301 at realsoftware dot com> <437AB283 dot 2040805 at ix dot netcom dot com> <437ABAE0 dot 5060307 at realsoftware dot com> <437B3367 dot 3080401 at ix dot netcom dot com> <437B49FB dot 7010002 at realsoftware dot com> <437B5BEC dot 3050704 at ix dot netcom dot com> <437B6769 dot 3030203 at realsoftware dot com>
Aaron Ballman wrote:

What this code is going to do is put a bunch of aces of Spades all over the window in a straight line.

NO! It does NOT put "a bunch of aces of Spades all over the Window." It puts ONLY (and never more than) TWO aces of Spades in the Window, one to replace the card at the bottom left which doesn't ever move, and the other which very neatly moves from left to right. (Maybe I didn't make that clear because I used the word "overlap.")

To repeat, there are only TWO Aces of Spades, and one of them moves very "neatly" from left to right. When it is drawn at a new position, the Ace of Spades at the immediate previous position on the left is very neatly erased.

Because you're stepping by 20, and the card widths themselves may be more, might be the reason why you're getting some sort of overlap.

"Overlap" may not have been the best choice of words to describe it. The new Ace of Spades, the one that moves, moves "under" the existing graphics (the existing cards) in a very realistic way. You'd swear that you were watching a film, with the same kind of two-dimentional representation producing an amazing illusion of three-dimensional reality.

However, it sounds to me like you're confused about the order of drawing. When you paint something directly on to the window (which is essentially what's happening here), the operations can become "stacked" based on the order you draw things. If you draw Card 1 and then draw Card 2, the second operation will occlude the first one (assuming their bounds overlap) because the first one is already painted onto the window and the second one paints over it. The same concept is true for controls -- they have a z-ordering just like paint operations do. So what is probably happening is that you're painting the card, and then a StaticText "paints" its Text over the card

I'm not sure exactly what you mean by "occlude," but if you mean something that looks like what you might get when you do a "double exposure" of a card moving to the right (see my P.S.), that is NOT what is happening. (I would not have been surprised if that had hapened; in fact, I would have expected it; but that is NOT what is happening.) When the new card is placed at the new position, the card at the old position not only is removed, but removed in such a fashion that the graphics are not messed up in any way.

.

As you click repeatedly on the "OK" button on the MsgBox, the Ace of Spades overlapped by the other two face-up cards moves cleanly to the right, remaining _under_ both the other two cards and the printing, and continues moving until it has completely passed also _under_ the stack of cards on the right! There is no mess-up in the drawing (nothing needs to be erased): it looks _exactly_ as if the one card were being slid _under_ the other cards as it moves from left to right.

Because you're using MsgBox as a way to pause your application, you cannot rely on anything you see. You're using MsgBox in the wrong way. Try using App.SleepCurrentThread( 1000 ) for a 1-second pause instead.

I just tried it again, replacing the MsgBox "Pause" with App.SleepCurrentThread( 1000 ), as you suggested, and apparently in this particular situation it makes no difference. (Well, there is a _slight_ difference, in that if you watch very closely you can see a slight flicker as the graphics are redrawn, BUT this does not take away from the fact the effect produced is that the new moving Ace _is_ moving from left to right, _leaving no traces behind it_.)

HTH!

Your comments are _always_ helpful, even when I may not have expressed myself clearly and you may or may not have understood exactly what it was that I was trying to say.

Barry Traver

P.S. Maybe I should explain what I mean by "double exposure." Imaging taking a picture of the three of diamonds. Then, without changing the position of the camera or advancing the film, move the card slightly to the right, and take another picture. The result is a picture of a card that looks slightly wider than usual (perhaps with fuzzy edges) and that contains six diamonds. Well, that is NOT what is happening in this scenario. The film _is_ advanced for each new picture. There _are_ no double exposures. There are never more than TWO Aces of Spades on the screen at one time.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>