Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Fruit machine, hold buttons.

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Fruit machine, hold buttons.

    Hi everyone, i have 2 questions that i need help with.

    I'm currently programming a fruit machine, i have the spin button working and randomly going through fruits and matching the fruits up correctly, I can insert money so it allows users to play and i get credit the money to the machine. I'm currently trying to work on getting the images of the fruits to spin like bandit reel and i need to implement hold buttons.

    My questions are:

    1) How do i get the pictures to do an animation spin like a reel? At the moment it just runs through the fruits and then stops and i'd like it to spin like a fruit machine reel and then stop, will i need to do some animation?

    2) How do i get hold buttons to work? There will be 3 hold buttons and when the user clicks the hold button it will stop that picture from spinning. I've assigned a timer to each reel e.g. timer1, timer2, timer3 i've assigned it so when the hold button is clicked then the appropriate timer will stop e.g. timer1.stop(); but it will only stop the reel whilst it's spinning.

    Hope i've not created to much confusion.

    Thank you for your help and reading!


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Fruit machine, hold buttons.

    Quote Originally Posted by LukeDavison View Post
    1) How do i get the pictures to do an animation spin like a reel? At the moment it just runs through the fruits and then stops and i'd like it to spin like a fruit machine reel and then stop, will i need to do some animation?
    Sounds reasonable to me.

    Quote Originally Posted by LukeDavison View Post
    2) How do i get hold buttons to work? There will be 3 hold buttons and when the user clicks the hold button it will stop that picture from spinning. I've assigned a timer to each reel e.g. timer1, timer2, timer3 i've assigned it so when the hold button is clicked then the appropriate timer will stop e.g. timer1.stop(); but it will only stop the reel whilst it's spinning.
    Instead of outright stopping the timer, signal that the animation should stop- either by stopping when the next picture is displayed, or having some kind of a countdown (so it doesn't stop on the absolute next one, but takes some time to slow down or something).
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Fruit machine, hold buttons.

    Thanks for your reply Kevin. I didn't really explain it clearly the first time but i wanted the hold buttons to stop the timer all together when clicked but when it was clicked the timer would still start and only stop half way through. That doesn't really sound like better explanation lol but it doesn't matter now, got it to work after hours of frustration and i appreciate your reply .
    Last edited by LukeDavison; November 26th, 2011 at 06:53 PM.

Similar Threads

  1. Replies: 1
    Last Post: July 9th, 2011, 07:17 AM
  2. Replies: 3
    Last Post: June 11th, 2011, 02:40 PM
  3. Moving MySql Database from one machine to another machine
    By vaishali in forum JDBC & Databases
    Replies: 5
    Last Post: July 21st, 2010, 01:21 AM
  4. Does this still hold true?
    By April in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: February 2nd, 2010, 09:28 AM
  5. help with my machine project.
    By Irvine in forum AWT / Java Swing
    Replies: 4
    Last Post: September 1st, 2009, 05:13 AM