Confused.... Help Please!


Results 1 to 32 of 32

Threaded View

  1. #29
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    To make the button gosub instead of goto to, 1 solution is :
    Code:
    main 
     button goto no_ship 'if button is NOT pressed, skip the gosub
     gosub ship   ' if button was pressed gosub and return
    no_ship
     button goto no_fire 
     gosub fire
    no_fire
    ....
    goto main
    As for the multi press and the way you are doing it, you have to check for when the button is released also. So when you have a button press, set a flag, then next time through the loop, if the flag is set, ignore the press. when the button is released, clear the flag.

    If cnt2==cnt gosub add

    you can move this line outside of the for next loop. It will be true each time the loop counts to cnt. so just process it before jumping back to main.

    as for the counting, you could use a timer setup as a counter. Just load it with a number, then in your mainloop check for an overflow. If it did, call your add. This way, as the levels get harder, just change the preload for the timer.
    Last edited by cncmachineguy; - 7th October 2010 at 19:31.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts