Need Some Help

crapscraps Member Posts: 353
edited November -1 in Working with GS (Mac)
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.

Comments

  • crapscraps 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. 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.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    The only way I can think seems a bit longwinded, but I don't know if there's a shorter way or not.

    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

  • crapscraps Member Posts: 353
    Thanks - started to work out the details and made just 10 random number choices for testing purposes.

    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
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi craps; maybe have a betting system? Perhaps the user could start off with $1,000 dollars. Before each dice roll (I actually started writing rice dole there, ha!) the user can place a bet, maybe up to $100 or up to any amount. If the user loses, they lose the money, if they win, doubles the money.

    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

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    craps wrote: "Gyroscope - thanks for your input - I have almost completed a craps tutorial and hope to finish it up soon. Your ideas are exactly what I am working on now for my second game Its an old dice game. You bet if the roll will be over 7, the #7 or under 7 and get paid out accordingly. Actually I dont need 36 random rules - I think - because there are 15 numbers that are over 7, 15 number that are under 7 and 6 #7. So really there are only three choices (rules) that I think I have to worry about. There will be a "roll" the dice button which will show a HD dice roll animation and all the dice outcome images will be HD. For the iPad. I am just stuck on how to compare the random dice outcome to the "bet" and then how to pay out or make the player lose money. Are there any betting templates out there that you might be aware of? Bruce"

    (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

  • crapscraps Member Posts: 353
    This is more than I could have ever hoped for. A lot to work on, for my limited back ground, but will make myself learn everything your outlined.

    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
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    You're welcome; glad it's going to help. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • crapscraps Member Posts: 353
    Had a day off work today - and have learn how to use change attributes, game and scene attributes and multiple rules.

    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?
  • crapscraps Member Posts: 353
    Had a day off work today - and have learned how to use change attributes, game and scene attributes and multiple rules.

    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?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Bruce, glad it's all coming together for you!
    craps said:

    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?

    Boolean attributes can be seen as being in two states, on or off; or true or false. And within the Rules, you can toggle between them, i.e when it's false make it true, otherwise when its true make it false.

    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

  • crapscraps Member Posts: 353
    Tried what was suggested - see below. It does pause the music when touched - however when you let up from the touch it resumes playing. Music does not stay off with a touch and back on with a touch.

    [IMG]http://i51.tinypic.com/b7hqh0.png[/IMG]
  • crapscraps Member Posts: 353
    Tried what was suggested - see below. It does pause the music when touched - however when you let up from the touch it resumes playing. Music does not stay off with a touch and back on with a touch.

    http://i51.tinypic.com/b7hqh0.png
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    The stuff in the Otherwise section, put it in the other Otherwise, i.e the one immediately under the Pause Music Behavior; it'll work then. :-)

    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

  • crapscraps Member Posts: 353
    Well for now I am working out my bet and pay out system.
    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
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    If the user/better is betting on the outcome of the total of two dice, I'd recommend actually showing the two dice, not one which rolls twice (I think that's what you are doing?). Think it would look better!

    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

Sign In or Register to comment.