Working Dice Mechanic?

Discussion in 'Game Design, Development And Publishing' started by Nasaki, Aug 10, 2019.

  1. Nasaki

    Nasaki Member

    Joined:
    Aug 10, 2019
    Posts:
    5
    So I'm currently working on a game play mechanic which is a core factor for my game basically I'm trying to get a working dice that can change and give different values every role kind like D and D is there anyone who can maybe point me in the right direction as to what it is exactly i can do to maybe make the the numbers random for every role so they aren't always 4 or 1.
     
  2. JON213

    JON213 Member

    Joined:
    Apr 8, 2019
    Posts:
    18
    Have you used the randomize() function in your create event? Please also post your code that you are using to roll the dice.
     
    sitebender likes this.
  3. Nasaki

    Nasaki Member

    Joined:
    Aug 10, 2019
    Posts:
    5
    I haven't used the randomize function and my code goes as follows

    Event Create
    1.image_speed = 0

    Step Event
    1.if image_angle > 0
    2.{
    3. image_angle -= 15
    4. image_index = choose (0,1,2,3,4,5)
    5. value_rolled = ". . . "
    6.}
    7.else
    8.{
    9. value_rolled= image_index + 1
    10.}

    Draw Event
    1. draw_text (x-60 , y + 20, "You rolled . . ." string (value_rolled))
    2. draw_self()

    This part was used on the pressing of the right key

    Right Key Pressed
    1.
    image_angle = 360




     
  4. curato

    curato Member

    Joined:
    Jun 30, 2016
    Posts:
    302
    randomize is the way to go. you will definitely want to run it in the create even for the dice and if randomness is really the core mechanic of your game you make want to have it run ever few rolls just to keep it really random.
     
    Nasaki likes this.
  5. Nasaki

    Nasaki Member

    Joined:
    Aug 10, 2019
    Posts:
    5
    Thanks ill give it a go and update it
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice