Thanks, but it works so far....maybe I did too much in design view.
ymilan
Posts
-
How to flip/turn cards over -
How to flip/turn cards overThanks for the expert comments: Questions: 1. I would like to keep what I have done in design view instead of writing more code to load those pics. I have Dimmed an array at the beginning to create the card deck; I cannot redundantly load the image array twice; the compiler won't let me; says it's already there. 2. In response to your #1, I wanted every other card to have the back.gif, so in essence it is flipped over. Am I actually loading the same image twice with my code? I thought using the For statement would at least start the counting from 0-51, but I wanted the counter to change the back of every other card. Your comment about boolean flags makes sense. I'm not asking you to write my code, but this isn't for a school assignment; it is a birthday present to my Mom, so help on boolean code would be very much appreciated. Hence, perhaps I can have a face up as a boolean, and a face down. How and where would I implement that; at loadform? Much appreciation in advance.
-
How to flip/turn cards overYou're right; I changed some of the code. I'm thinking that on mousedown event, somewhere I would flip the backing cards over when the user presses the mouse down on the card. How would I do that? Here it is: Option Explicit Public Sub FormLoad() End Sub Private Sub Exit_Click() MsgBox ("Thank you for playing. Good Bye.") End End Sub Private Sub Start_Click() Image2.Visible = False Dim Selected As Boolean Dim arrDeck(52) Dim Cardcount As Integer Dim Counter As Integer Dim Index As Integer Do While Cardcount <= 52 arrDeck(Cardcount) = Cardcount Cardcount = Cardcount + 1 Loop Dim swap As Integer Dim posn1 As Integer Dim posn2 As Integer Randomize For swap = 0 To 50 ' Get two random positions posn1 = Int(52 * Rnd) posn2 = Int(52 * Rnd) ' Swap pictures at these positions If (posn1 <> posn2) Then KingH(0).Picture = Image1(posn1).Picture KingH(0).Tag = Image1(posn1).Tag Image1(posn1).Picture = Image1(posn2).Picture Image1(posn1).Tag = Image1(posn2).Tag Image1(posn2).Picture = KingH(0).Picture Image1(posn2).Tag = KingH(0).Tag End If Next swap Start_Game.Refresh For Counter = 0 To 50 &nbs
-
How to flip/turn cards overI already have an array of images in design view; it would be redundant to load them, wouldn't it?
-
How to flip/turn cards overand pardon my less knowledge, but how would you do this?
-
How to flip/turn cards overTrying to understand completely what you are saying: Basically, I have random cards of all suits on the left of the form. Each other card has a back.gif to show the back of the card. Each card is in an array of 52 cards. When a user clicks the backing card, I want the let's say queen of hearts to show up, hence image1(12), that picture; before they drag the card. I tried this with If image1(index).picture = loadpicture("C:\backing.gif") Then image1(12).picture = loadpicture("C:\queenhearts.gif") and so forth; I would write all the images and set them to the correct gifs. At runtime, nothing worked when I clicked those cards.... I even thought of trying image1_click(Index As Integer), but that didn't work either. Any ideas on how to within the same routine, to turn the cards or set them to the proper gif when the user clicks on them? Seems so simple, but I'm still confused.
-
How to flip/turn cards overThe card with the back image is from the loadpicture("aaaa.gif") but the original picture bitmap formed in design view is the suit card.
-
How to flip/turn cards overI want to know how to flip the cards with backing.gif over to the original card in the random pile. I have one face up, the next one face down, etc.
-
How to flip/turn cards overI have a solitaire game and got drag and drop to work. The thing is the random cards display every other card with a different backing to simulate the back of the card. I would like the player that when they move or click the backed card, it turns over to it's original card. Here's an example of my code: Note I set 001h as an example to test. Private Sub Image1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, _ X As Single, Y As Single) Image1(Index).Drag vbBeginDrag End Sub Private Sub Image1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, _ X As Single, Y As Single) If Image1(Index).Picture = LoadPicture("C:\Program1\Back.gif") Then Image1(Index).Picture = LoadPicture("C:\Program1\001h.gif") MsgBox ("ok") End If End Sub
-
VB6 card game questionWhen I put the images on the left in design view as automatic, when they are in a random place, i.e. image1(0), King of Hearts, they do not move at all. When I put them in manual, they move. For some reason; and you said; but I don't understand the reason; when in State 0, I move the images, i.e. King of Hearts to the top of the hearts(0) image (a white backing gif, not King of Hearts. I did this so I can show a white backed card, so the player can see a white card instead of a black space. I can place the redbacking card no problem when the card enters the white backed card on the right. It works. However, if it is right, it doesn't drop the Image1(Index).Picture at all. It leaves it a redbacking gif. Now, when my images on the left are randomized, and I want to pic out the King of Hearts on the left, somewhere in the shuffle, it says you're wrong when I place it over the hearts(0) position on the right. It shows a red backing but, does not say You're right or drop the card. I have that code in my hearts dragdrop; you'll see above in my last code reply. However, when I place a random card from the Image1(0) POSITION on the left, it works and says you'r right, but that is the wrong card....???? Don't understand. It leaves a redbacked gif as well, when it is the wrong card, but say's your're right. You're helping me and I'm glad; Thank you.
-
VB6 card game questionCan I have your email address again to take this offline? I have some gifs to show you. Thanks. YMilan
-
VB6 card game questionWow! Thanks for the expert explanation. Does this mean I would put: Image1(0).Tag = Hearts(0).Tag Somewhere in the first part of the code? Where so? This is all my code so far; problem is which ever card is in the first slot (as in Image1(0)), but can be any card, when dropped over Hearts(0), it says, you're right and allows drop. If the real Image1(0).Picture, King Hearts is dropped over Hearts(0), it says you're wrong. I changed all my settings in design mode to put images on the left as Automatic and none for both OLE modes. I set images on the right to be Manual for drag and none for both Ole modes. Any problems on this? Here is all of my code so far: I appeciate your help.... Option Explicit Public Sub Main() Start_Game.Show End Sub Private Sub Exit_Click() MsgBox ("Thank you for playing. Good Bye.") End End Sub Private Sub Start_Click() Dim arrDeck(52) Dim Cardcount As Integer Dim Counter As Integer Do While Cardcount <= 51 arrDeck(Cardcount) = Cardcount Cardcount = Cardcount + 1 Loop Dim swap As Integer Dim posn1 As Integer Dim posn2 As Integer Randomize For swap = 0 To 100 posn1 = Int(52 * Rnd) posn2 = Int(52 * Rnd) If (posn1 <> posn2) Then KingH(0).Picture = Image1(posn1).Picture Image1(posn1).Picture = Image1(posn2).Picture Image1(posn2).Picture = KingH(0).Picture End If Next swap Counter = 0 For Counter = 0 To 51 Image1(Counter).Visible = True Next Counter End Sub Private Sub Hearts_DragOver(Index As Integer, Source As Control, _ X As Single, Y As Single, State As Integer) If Index <= 12 Then If State = 0 Then &n
-
VB6 card game questionOk, this is the code I have so far, but ALL the cards from every suit are allowed to drop on the target. In design view, I need some assistance on whether to put Manual, Autmatic, or None or DragDrop, OLEDragOver, OLEDragDrop.....I think that may be messing this whole thing up. Anyhow, my code is below; any errors? Private Sub Hearts_DragOver(Index As Integer, Source As Control, _ X As Single, Y As Single, State As Integer) For Index = 0 To 12 If State = 0 Then CommonDialog1.Flags = &H80FFFF CommonDialog1.ShowColor Hearts(Index).BackColor = CommonDialog1.Color Else If State = 1 Then CommonDialog1.Flags = &HFFFFFF CommonDialog1.ShowColor Hearts(Index).BackColor = CommonDialog1.Color Else If State = 2 Then End If End If End If Next Index End Sub Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single) For Index = 0 To 12 Hearts(Index).Picture = Source.Picture Source.Picture = Image1(Index).Picture Next Index For Index = 0 To 12 If Image1(Index).Picture = Hearts(Index).Picture Then Image1(Index).DragMode Manual Image1(Index).Drag vbEndDrag MsgBox ("You're Right") Else Image1(Index).Drag vbCancel MsgBox ("You're Wrong") End If Next Index
-
VB6 card game questionAwesome! I understand dragover now! I will write that and see how I do. However, please assist on dragdrop; what do I put in that code? I tried hearts(index).Picture = Source, like every tutorial I read said to do. Then do I do vbenddrag and vbcancel like I did before, or is this in error?
-
VB6 card game questionThis is what I've tried as well....still in design mode I have each image1 card set to Manual for dragmode, Automatic for oledragmode and automatic for oledropmode. Not sure what to set the hearts cards to though...tried many different modes and all seems confusing...here is my code so far: Wondering if I should have the question of whether image1(1 through 12) = Hearts(1 through 12) in the dragdrop not dragover....I tried that too, but no avail. Public Sub Image1_Click(Index As Integer) For Index = 0 To 12 Hearts(Index).Picture = Image1(Index).Picture Next Index For Index = 13 To 25 Clubs(Index).Picture = Image1(Index).Picture Next Index For Index = 26 To 38 Diamonds(Index).Picture = Image1(Index).Picture Next Index For Index = 39 To 51 Spades(Index).Picture = Image1(Index).Picture Next Index End Sub Private Sub Hearts_DragOver(Index As Integer, Source As Control, _ X As Single, Y As Single, State As Integer) For Index = 0 To 12 If State = vbEnter Then If Source.Picture = Image1(Index).Picture Then If Image1(Index).Picture = Hearts(Index).Picture Then Image1(Index).Drag vbEndDrag MsgBox ("You're Right") Exit Sub Else Image1(Index).Drag vbCancel MsgBox ("You're Wrong") Exit Sub End If End If End If Next Index End Sub Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single) For Index = 0 To 12 Hea
-
VB6 card game questionOh in addition, what I need to know is what setting, manual, automatic, or none do I set in design view for the one dragmode, and two oledrag properties?
-
VB6 card game questionI'm a bit still confused; you think I should use dragover? dragdrop seems to allow me to drag and drop the cards just fine. Problem is I don't know how to write the code for this....what you are stating....I know State is for dragover, but if I don't use that, I use source for dragdrop. Now I don't even know the right settings for the cards on the left and on the right for in design mode, dragmode, oledragdrop, and oledrag...something, can't remember off the top of my head. But now I have all those confused and that's what might be causing my code not to work properly. Can you pleeeeeese help? You're my only hope.
-
Need Assistance on OLEDragDrop and Drag methodsYes, and thank you. However, I need to gather more info. I'm still a bit confused. I know I'd like to set the properties at design time and set them to remain that way throughout the entire program. Here it is: 52 cards on left; 12 of which I ONLY want to match 12 cards on the right when dropped. 52 cards get randomized, and I pick out one by one those 12 cards and drop it on a spot on the right. It works. Now here is what is wrong: ALL the cards, including those 12 cards drop on the right; I was only allowing in my code in the IF statement that when one of the 12 cards of the heart suit on the left = the heart suit on the right, only those cards can be dropped, not every card of the other suits. Second problem. Only the last position Hearts(12) on the right is taking cards. The rest of the 12 position won't take any cards. Any idea on WHAT to set on those drag mode properties at design time? I've played around and have gotten nowhere. Thank you in advance
-
Need Assistance on OLEDragDrop and Drag methodsI have a solitaire game where I have 52 cards lined up in design view. I'm wondering (in design view) what to set the oledragmode, oledropmode, and dragmode elements to; automatic? manual? What's happening with my code below is that I only want 12 hearts cards to be dragged to blank card positions on the right of the screen. However, all the cards drag and all cards, including hearts cards can only drop onto the 13th blank card on the right. Not the 0 to 12. Should I write some code to set or clear the dragmodes and what do I do in design mode? I only want the first 12 cards of the 52 cards to be dragged; they are hearts cards and I want 12 blank cards on the right to be the hearts suit only. Pardon me; I'm new to this; Also Much appreciation in advance. Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single) Dim HeartsIndex As Integer Image(0).Picture = Hearts(0).Picture Image(1).Picture = Hearts(1).Picture Image(2).Picture = Hearts(2).Picture Image(3).Picture = Hearts(3).Picture Image(4).Picture = Hearts(4).Picture Image(5).Picture = Hearts(5).Picture Image(6).Picture = Hearts(6).Picture Image(7).Picture = Hearts(7).Picture Image(8).Picture = Hearts(8).Picture Image(9).Picture = Hearts(9).Picture Image(10).Picture = Hearts(10).Picture Image(11).Picture = Hearts(11).Picture Image(12).Picture = Hearts(12).Picture For Index = 0 To 12 For HeartsIndex = 0 To 12 If Image1(Index).Picture = Hearts(HeartsIndex).Picture Then Hearts(HeartsIndex).Picture = Source(HeartsIndex).Picture Image1(Index).Drag vbEndDrag MsgBox ("You're right") Exit Sub Else Image1(Index).Drag vbCancel MsgBox ("You're Wrong") Exit Sub End If Next HeartsIndex Next Index End Sub
-
Please help a newbie that is totally confused....Yep we did; thanks! I have another question. Trying to move the image1(12) card (drag and drop) to the hearts(12) card. Testing to see if the tags are equal first, which they are set in design view, then setting the same image bitmap of image1(12) card over (dropped on) the blank image of hearts(12) card. What happens at run time is ALL the cards 0 - 12 of image1 can only be dropped in hearts(12) spot. None of the other cards in the image1 stack (up to 52, remember, I'm just doing a sample first) can be dropped over the hearts cards, but no "shirley" error message pops up either. Any suggestions? Pardon the format; just testing now 'Private Sub Image1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single) 'Image1(Index).Picture = Source.Picture 'End Sub Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single) 'Dim ImageIndex As Integer Dim HeartsPic0 As Image HeartsPic0.Picture = Source.Picture Source.Picture = LoadPicture("C:\Program1\013h.gif") If Image1(12).Tag = Hearts(12).Tag Then Hearts(12).Picture = HeartsPic0.Picture &