Need Some Help
craps
Member Posts: 353
I am working on a dice game and have completed the graphics for the 36 possible dice pair outcomes.
A part that I am currently stuck on is this:
Basic Idea:
The player can choose either actor 1 or 2 and then "rolls" the dice (actor 3) and a random outcome is determined. What I need to do is compare the random (1/36) outcome to either actor 1 or 2 (which ever was picked)
If the random number equals the actor chosen then the player is a winner if not a loser.
Heres where my limited experience is getting me.
Created a Game Attribute - checkedActor1, checkedActor2, pickAcard.
Actor 1 - Rule - touch.inside - attribute.checkedActor1=true
Actor 2 - Rule - touch.inside - attribute.checkedActor2=true
Actor 3 - Rule - touch.inside - animate - attribute -pickAcard.(random1,36) I already have the random part figured out ( Oh can I choose from 36 possible outcomes?)
What I need to learn is how to take the random number outcome - compare it to either actor 1 or 2 and if it matches the picked actor make it a winner if not a loser.
Hope I explained to clearly. Dont shake your head too much - I am trying.
A part that I am currently stuck on is this:
Basic Idea:
The player can choose either actor 1 or 2 and then "rolls" the dice (actor 3) and a random outcome is determined. What I need to do is compare the random (1/36) outcome to either actor 1 or 2 (which ever was picked)
If the random number equals the actor chosen then the player is a winner if not a loser.
Heres where my limited experience is getting me.
Created a Game Attribute - checkedActor1, checkedActor2, pickAcard.
Actor 1 - Rule - touch.inside - attribute.checkedActor1=true
Actor 2 - Rule - touch.inside - attribute.checkedActor2=true
Actor 3 - Rule - touch.inside - animate - attribute -pickAcard.(random1,36) I already have the random part figured out ( Oh can I choose from 36 possible outcomes?)
What I need to learn is how to take the random number outcome - compare it to either actor 1 or 2 and if it matches the picked actor make it a winner if not a loser.
Hope I explained to clearly. Dont shake your head too much - I am trying.
Comments
A part that I am currently stuck on is this:
Basic Idea:
The player can choose either actor 1 or 2 and then "rolls" the dice (actor 3) and a random outcome is determined. What I need to do is compare the random (1/36) outcome to either actor 1 or 2 (which ever was picked)
If the random number equals the actor chosen then the player is a winner if not a loser.
Heres where my limited experience is getting me. I know it just a start.
Created a Game Attribute - checkedActor1, checkedActor2, pickAcard.
Actor 1 - Rule - touch.inside - attribute.checkedActor1=true
Actor 2 - Rule - touch.inside - attribute.checkedActor2=true
Actor 3 - Rule - touch.inside - animate - timer - then the random generator rules/behaviors. I already have the random part figured out ( Oh can I choose from 36 possible outcomes?)
What I need to learn is how to take the random number outcome - compare it to either actor 1 or 2 and if it matches the picked actor make it a winner if not a loser.
Hope I explained to clearly. Dont shake your head too much - I am trying.
After your pickAcard.(random(1,36) you'll need 36 Rules
When pickAcard is 1 then
.......
When pickAcard is 2 then
......
etc, comparing the pickAcard attribute with ones made for Actor 1 and 2. If it matches then win, doesn't match then lose. Hope that helps you. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
After the pickAcard is chosen would I say something like:
Rule #1
ALL
pickAcard 1 = true
Actor 1 is = true
then winner - what do do from here?
Rule #2
ALL
pickAcard 1 = true
Actor 1 = false
then - what to do from here?
Suggestions?
Thanks
Maybe also at some later stage you could make the game more sophisticated by adding more screens with other dice games, picking a pair, for instance, also with betting involved. Just a thought!
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
(The following too long to go into a message reply, hence put here in the Forum); Hi Bruce, no betting templates that I'm aware of, sorry. But you sound like you're on the right track from what you've written.
Maybe you could have (or do have) several buttons for the betting, $1, $2, $5, $10, $25 and $100. Another attribute called UserBet, so that when $1 is clicked Change Attribute UserBet to UserBet+1, when $2 is clicked Change Attribute UserBet to UserBet+2, etc. Also you need: another attribute for the amount of money the user starts with, we'll call it PlayerAmount, set at 1000. So the Display Text Behaviour will be game. (or scene.) PlayerAmount. So in each of these betting buttons, you need change attribute PlayerAmount to PlayerAmount-UserBet.
OK, about the user's number. The 3 buttons, each one clicked, change attribute UserDiceChoice to 1, 2 or 3, depending on which is selected, for more than 7, equal to 7 or less than 7.
The dice rolls are presumably random(1,6) each. The first result goes in Dice1Result, the second in Dice2Result. When both have rolled put both values into another attribute called TotalRoll, so Change Attribute TotalRoll to Dice1Result+Dice2Result. (don't forget, at some point to set TotalRoll to 0 before the next rolling).
then When TotalRoll >7 change attribute FinalDice to 1, when TotalRoll=7 then change attribute FinalDice to 2, and when TotalRoll<7 change att. FinalDice to 3.
Then Rules, When UserDiceChoice=FinalDice change attribute PlayerAmount to PlayerAmount + (UserBet *2)
Change Attribute UserBet to 0
Set the alpha of scene.WinGraphic to 1 (as an idea, fading it out over two seconds back to 0 perhaps)
When UserDiceChoice does not equal FinalDice then
set the alpha of scene.LoseGraphic to 1
(There's no need to take away any money, as that was deleted at the betting stage).
Now this is all off the top of my head, but I'm pretty much certain you'll get it to work as you want from my explanation, adding refinements as you go.
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I bet many of us, myself included, don't really know how much help we can ask for on the forum. We may have a great idea for a game or app but get lost in our lack of experiece.
For myself, I am always willing to learn my way through a problem but just need a little push in the right direction.
You and many others have provided that and it is very appreciated.
Craps
Thanks
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I have prototyped almost an entire game with very basic actors - 10 hours work as of now - but there are several little things that will tie it all together that still need some working out.
First for the a simple thing - made a "gameMusic" attribute and when the actor is touched -" gameMusic" attribute...TO false- pause music.
How to I get the music to start again if the same actor is touched?
I have prototyped almost an entire game with very basic actors - 10 hours work as of now - but there are several little things that will tie it all together that still need some working out.
First for the a simple thing - made a "gameMusic" attribute and when the actor is touched -" gameMusic" attribute...TO false- pause music.
How to I get the music to start again if the same actor is touched?
So one way to do this would be: make a boolean attribute called MusicPaused and leave it unchecked (i.e false).
Then in the Rules of your actor, put:
Rule
When touch is pressed
Rule (within the first Rule)
When self.MusicPaused is false
Change Attribute self.MusicPaused to true
Pause Music
then in the Otherwise section:
Change Attribute self.MusicPaused to false
Play Music Resume Current Music.
Hope that helps. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
[IMG]http://i51.tinypic.com/b7hqh0.png[/IMG]
http://i51.tinypic.com/b7hqh0.png
PS Might be safer to add under the first Rule, changing it to when any conditions are valid:
Actor Receives event touch is pressed (as well as the inside one).
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Currently I have tested out and got working the following:
If bet #1 is chosen and the outcome = the player bet - he's a winner and a "winner" text is displayed.
If the outcome is any thing different from the player bet the player is a loser and a "you lose" text is displayed.
Currently this system is working for 6 numbers - one dice.
I want to have the 36 possible random outcomes (from 2 dice) represent 36 different individual images.
How can I do the following:
1. associate each of the 36 random outcomes to their corresponding images?
2. appoint a game attribute to each image? - this will be used to compare the outcomes to the player bet.
Thanks
If you do have the two dice to roll, with six images for each, then you'll need only six images for both.
So when the first random number is generated, put When Dice1Result is 1 then change image to Dice1.PNG, when Dice1Result is 2, change image to Dice2.PNG, etc. up to 6. Then the same with Dice2Result.
As a refinement, you could, when the User presses the Bet Now button or whatever you're using, have a short animation of random sides of the dice, flashing fast from one to the other. So for your first image, add a dice roll sound effect, the random sides for two seconds, then another Timer, after 2 secs, change the image accordingly. Then for the second dice, exactly the same, except adding yet another Timer that contains all the other stuff for the second one, which would be After 2 seconds. (So basically, you've got dice sound effect + random sides flashing for 2 seconds, then image change for first dice; just after that, the flashing dice + sound effect for another 2 seconds, then again the change of image).
This is easier to do than explaining it in words, I think; I hope I've explained it well enough.
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps