

-----------------------------------

MrC

Tue Mar 30, 2010 4:34 pm


Need help with 'Click to continue' code

-----------------------------------

Hello,

I am writing a game with Turing 4.1. I'm a compsci teacher, and doing this for my own enrichment ...

My program starts by drawing some graphics. Next, I attempt to draw a canvas over the existing graphics. Everything works fine ... Until I tried to create a "click to continue" portion of code.

The program flow gets all messed up. Even though the loop that waits for a mouse click is at the very end of my program, it stops the drawing partway through and only continues after I click. The click is currently the last part of the program, so I can't figure out why this is happening. I can't paste my whole code because it involves importing graphics and maps from files, but I'll post the jist of the problem:

% draw graphics
% create a GUI.Canvas and display it
% Draw some text into the canvas, including "click to continue"
View.Update
loop
    Mouse.Where(x, y, b)
 
    exit when b = 1
end loop


When I remove the mouse command everything is drawn perfectly. When I put it back in, it stops drawing part way through and only finishes the drawing after I click. It just doesn't make sense! HELP please!! :)


-----------------------------------

Tony

Tue Mar 30, 2010 5:14 pm


RE:Need help with \'Click to continue\' code

-----------------------------------

The code sample doesn't demonstrate the described problem.

Also, we have [ syntax="turing" ] tags to paste code into.


-----------------------------------

MrC

Tue Mar 30, 2010 5:18 pm


RE:Need help with \'Click to continue\' code

-----------------------------------

I fixed it. Here is the code that works:

    font1 := Font.New ("Times New Roman:14:bold,italic")
    font2 := Font.New ("Times New Roman:10")
    font3 := Font.New ("Arial:10")

    GUI.Show (canvas)
    GUI.FontDraw (canvas, "Welcome to Drakefield Legend", 5, 160, font1, green)
    GUI.FontDraw (canvas, "A Game by Jordan Cohen", 5, 145, font2, black)
    GUI.FontDraw (canvas, "Click to Continue", 75, 35, font3, grey)
    View.Update
    loop
        Mouse.Where (x, y, b)

        exit when b = 1
    end loop


Seems to work well. "canvas" is a pre-defined GUI canvas.


-----------------------------------

USEC_OFFICER

Tue Mar 30, 2010 6:45 pm


RE:Need help with \'Click to continue\' code

-----------------------------------

I don't see the difference between the two bits of code. (The important bits) However since the problem is solved, I hope your game turns out well.


-----------------------------------

Euphoracle

Tue Mar 30, 2010 7:14 pm


RE:Need help with \'Click to continue\' code

-----------------------------------

Look into Input.Pause.


-----------------------------------

MrC

Wed Mar 31, 2010 7:14 pm


Re: RE:Need help with \'Click to continue\' code

-----------------------------------

Look into Input.Pause.

I'll check that out, thansk for the tip.

Oh and I realize now that my question was in fact very unclear  :|  I was frustrated ... but it turned out to be a View.Update issue.

I'll post the game when (if ever) it is complete :)


-----------------------------------

USEC_OFFICER

Wed Mar 31, 2010 7:41 pm


RE:Need help with \'Click to continue\' code

-----------------------------------

Now I am even more confused. But still looking forward to it.

