
-----------------------------------
upthescale
Wed Jun 21, 2006 8:02 pm

Shooting Problem
-----------------------------------
Try and shoot with the enter key:




%Project: Traffic Light 
%Purpose - to create an interface between the computer and the (light) box 
%Question 1 - 130 points 

% VARIABLE TABLE 
% x - int - the x coordinate that the user clicked on 
% y - int - the y coordinate that the user clicked on 
% bnum - int - the button that you select on the mouse 
% bud - int - whether the button is pressed (1) or released (0) 
setscreen ("graphics:vga") 
%var for the button's coordinates 
var x, y, bnum, bud : int 
%var for the traffic buttons 
var rb, yb, gb : int := 0 
%var for the of the words. size and type 
var font : int 
%var for the number of flashs 
var flash : int := 0 
%var for the number of rotates 
var rotate : int := 0 
%var for the number of patterns 
var pattern : int := 0 
%var for the output of the parallel put for the on an off swtich 
var swt : int := 0 
var fp : int 
%color of background 
colorback (gray) 
%font size and type 
font := Font.New ("Arial:14") 
Font.Draw ("WELCOME  TO  MY  TRAFFIC  LIGHT  PROGRAM", 80, 305, font, 7) 
%loop command, keeps the program going 
loop 
    drawfillbox (390, 110, 560, 230, brown) 
    drawfillbox (100, 110, 270, 230, brown) 
    Font.Draw ("Test Mode", 141, 166, font, white) 
    Font.Draw ("Scenerio Mode", 413, 166, font, white) 
    drawfillbox (0, 35, 700, 0, 7) 
    drawfillbox (0, 800, 700, 355, 7) 
    locate (21, 25) 
    put "please slect a mode" 
    buttonwait ("down", x, y, bnum, bud) 
    if (x >= 50 and x = 110 and y = 25 and x = 300 and y = 125 and x = 300 and y = 225 and x = 300 and y 