Author Topic: Turing help?  (Read 3483 times)

Jaitsu

  • *
  • Posts: 1067
  • DON'T FWOOSH ME BRO
    • View Profile
    • Jaitsu Studios
Turing help?
« on: 2010-04-30 06:21:23 »
if anyones good at turing, perhaps you can help me. you see, i created an average finder in turing to find the average of two imputed numbers by the user, and also added a small button in the corner that the user can click to exit, that being said, i've modified it so that it changes color when the mouse moves on to the "button" (drawfilloval) by overlapping it with another button any time the mouse is in that area, however, it seems that will not work correctly, as it makes it give strange colors, a hybrid of the two if you will (the two colors overlapping eachother). im at a loss at how to fix this issue, i shall post the full program in its .t format here:

/******************************************************************************
 Author: Brandon Russwurm
 Last modifide: Tuesday, March 30th, 2010
 Version 2.0
 Program Name: Average Finder
 Function: requests 2 numbers, then finds the average and displays
 ******************************************************************************/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%VARIABLES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var user_wants_to_quit : boolean := false
var one_number : int
var another_number : int
var average : real
var yes_no : string (1)
var ballx : int := 670
var bally : int := 30
var r : int := 0
var x : int := 600
var y : int := 10
var button : int := 0
setscreen ("nocursor")
r := 20
setscreen ("graphics:700;500")
colour (0)
colorback (7)
cls
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%PROCEDURES & FUNCTIONS%%%%%%%%%%%%%%%%%%%%%%%

process AVERAGE_FINDER
    loop
        locate (28, 80)
        colour (3)
        put "EXIT"
        locate (1, 36)
        colour (2)
        put "Av FINDER"
        locate (2, 37)
        colour (0)
        put "enter #"
        if hasch () then
        locate (3, 37)
        colour (3)
            get one_number
            locate (4, 34)
            colour (0)
            put "enter second #"
            locate (5, 37)
            colour (3)
            get another_number
            average := one_number + another_number / 2
            locate (6, 32)
            colour (0)
            put "the average is ", average, ""
        end if
        exit when user_wants_to_quit
    end loop
end AVERAGE_FINDER

proc drawball
    drawfilloval (ballx, bally, r, r, 6)
end drawball

proc drawball2
   if sqrt ((x - ballx) ** 2 + (y - bally) ** 2) < r and (button = 0) then
   drawfilloval (ballx, bally, r, r, 10)
   end if
   end drawball2




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%MAIN PROGRAM%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fork AVERAGE_FINDER
loop

    drawball
   
    drawball2


    mousewhere (x, y, button)
    if sqrt ((x - ballx) ** 2 + (y - bally) ** 2) < r and (button = 1) then
        user_wants_to_quit := true
        exit
    end if
end loop

sl1982

  • Administrator
  • *
  • Posts: 3764
  • GUI Master :P
    • View Profile
Re: Turing help?
« Reply #1 on: 2010-04-30 06:24:51 »
People still use turing?

Jaitsu

  • *
  • Posts: 1067
  • DON'T FWOOSH ME BRO
    • View Profile
    • Jaitsu Studios
Re: Turing help?
« Reply #2 on: 2010-04-30 06:25:24 »
People still use turing?

:P its easyish, and its what i was first introduced to