RE: Help with coding

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thanks Irv, u are a great help in this--i think i have a final two 
questions for you, what exactly do u mean by "pointer" (if u have not 
noticed, i'm very new at this)? And where can i find Judith's IDE? I 
searched for it, but cannot find it.

irvm at ellijay.com wrote:
> On Saturday 21 July 2001 16:24, Travis Weddle wrote:
> 
> > Ok--I think I some what understand where this is headed, now what i need
> > to know is how do i "link" the pushbuttons with the actions, and the
> > checker pieces to move them.?
> 
> Since you're asking this, I'm guessing that you aren't using 
> Judith's IDE. If you were, you would just click on the button and
> enter your code in the event window that pops up. The IDE makes 
> the layout of a program such as this a 5 minute job. 
> 
> What you want to do is to add your bitmap display/hide code to 
> the onClick[] events for the "Next" and "Prev" buttons.  
> 
> For the "Next" button, it would be something like:
>  1. increment the move pointer by 1
>  2. get the color of the checker in [SOURCE] square
>  3. hide the source checker (or put a blank bitmap there)
>  4. put the proper color checker in the [DESTINATION] square
> 
> For the "Prev" button, the code would be slightly different:
>  1. swap {SOURCE] and [DESTINATION] -- to undo the last move
>  2. get the color of the checker in the [SOURCE] square
>  3. hide the source checker
>  4. put the proper color checker in [DESTINATION]
>  5. decrement the move pointer by 1
> 
> Note that steps 2, 3 and 4 in the "Prev" code are exactly the 
> same as steps 2,3 and 4 in the "Next" code. That means 
> those steps could be written only once, as a separate procedure,
> so you wouldn't have to write and debug twice.  That simplifies 
> your onClick event code:
> 
> procedure NextButton_onClick ()
> if pointer < length(move) then 
>   pointer += 1
>   MoveChecker(move[pointer])
> end if
> end procedure
> onClick[NextButton] = routine_id("NextButton_onClick")
> 
> procedure PrevButton_onClick ()
>  MoveChecker({move[pointer][DESTINATION],
>                        move[pointer][SOURCE]}) -- this swaps the order
>  if pointer > 1 then
>     pointer -= 1 
>  end if
> end procedure
> onClick[PrevButton] = routine_id("PrevButton_onClick")
> 
> You don't actually need to link the checker pieces in any way, unless 
> you want to move them by clicking on them. 
> 
> Hope this helps,
> Irv
> 
> 



Trav

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu