Shop OBEX P1 Docs P2 Docs Learn Events
some kind of counter — Parallax Forums

some kind of counter

jive turkeyjive turkey Posts: 2
edited 2007-10-14 17:50 in BASIC Stamp
im trying to make a light display to loop through 2 different events, the theme is footballs teams and the light display will have michiganstate helmet and u of m helmet butting together
i want ms to win then then program loops only the second time u of m wins

i was thinking having the have some kind of internal counter that resets itself where on 0 ms wins and on 1 u of m wins and after one the counter resets itself to 0 i just dont know how to write that in anywhere

i can visualize something like


helmets rise:
"statements telling the helmets to run into eachother"
if count equals 0 then ms victory
if count equals 1 then u of m victory

i just cant figure out how to initialize the counter or where to have it at in the code

plz help

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-10-14 17:50
    There are several ways you might do this, here is a pretty simple solution that might fit. It's a branch statement and the address offset (idx)·is toggled as each branch is executed.

    idx VAR Bit
    main:

    '
    / Animation code here

    PAUSE 1000
    BRANCH idx,[noparse][[/noparse]MS_wins,UM_wins]
    MS_wins:
    DEBUG "MS_wins",CR
    idx=1
    GOTO main
    UM_wins:
    DEBUG "UM_wins",CR
    idx=0
    GOTO main

    Jeff T.
Sign In or Register to comment.