For anyone too lazy to download it,
Turing: |
%********************************
%name block ICS 3M ICS 3M ICS 3M ICS 3M
%name - Justyn Capeling
%date - March 11/2009
%program description - Keystroke Game
%*********************************
%
%
%*********************************
%Algorithm
%A set of instructions in order, used to pre-plan a program
%**************************THESE ARE THE MOST IMPORTANT STEPS FOR KEYSTROKE********************
%DRAWGAME PIECE WITH PARAMETERS
%CAPTURE GAME PEICE WITH PIC.NEW AND PCID
%DRAW BACKGORUND WIHTOUT PARAMETERS
%SET UP INFINITE LOOP FOR MULTIPLE KEYSTROKE USING LOOP END LOOP
%USE DRAW DELAY COVER CONCEPT WHERE DRAW IS PIC.DRAW FOR GAMEPIECE AND COVER IS PIC.DRAW
%DETERMINE KEYSTROKE ARROWS USING INPUT.KEYDOWN
%CHECK KEYSTROKE USING IF COMMAND
% ADD VALUES TO X OR Y CORDINIATE USING X:=X+5 OR Y:=Y+5 WHICJ IS CALLED SUMMATION
% CHECK BOUNDRIES/SCREEN EDGE USING IF X
%*********************************
%
%
%*********************************
%Variables Dictionary
%declare variable by name and type
var picID : int %....................represents the gamepiece in memory
var chars : array char of boolean %..sets aside memory for keystroke
var i : int
var l : int := 0
var t : int := 0
var x, y : int
var x1, y1 : int
var posx, posy : int
var velx, vely : int
var show : boolean := true
x := 520
y := - 10
x1 := 100
y1 := 100
%*********************************
%
%
%*********************************
%Procedures/Subprograms/Subroutines
%do each seperatly in a block
proc GAMEPIECE (var x : int, var y : int)
drawfilloval (50 + x, 53 + y, 7, 7, 66) %....................................Head
drawfillbox (45 + x, 45 + y, 55 + x, 25 + y, 42) %...........................Body
drawfillbox (43 + x, 55 + y, 57 + x, 60 + y, 42) %...........................Hat
drawfillbox (38 + x, 55 + y, 43 + x, 57 + y, 42) %...........................Hat Lid
drawfilloval (46 + x, 52 + y, 1, 1, black) %.................................Eye
drawline (45 + x, 49 + y, 49 + x, 49 + y, black) %...........................Mouth
Draw.ThickLine (48 + x, 25 + y, 46 + x, 15 + y, 6, 42) %.....................Left Leg
Draw.ThickLine (52 + x, 25 + y, 54 + x, 15 + y, 6, 42) %.....................Right Leg
Draw.ThickLine (50 + x, 40 + y, 36 + x, 38 + y, 4, 42) %.....................Arm
drawfillbox (45 + x, 30 + y, 55 + x, 28 + y, black) %........................Belt
Draw.ThickLine (45 + x, 45 + y, 15 + x, 45 + y, 3, 20) %.....................Gun
Draw.ThickLine (30 + x, 43 + y, 43 + x, 43 + y, 3, 138) % ...................Handle
Draw.ThickLine (36 + x, 40 + y, 42 + x, 40 + y, 4, 138) %
end GAMEPIECE
proc GAMEPIECE1 (var x1 : int, var y1 : int)
drawfilloval (50 + x1, 53 + y1, 7, 7, 66) %..................................Head
drawfillbox (45 + x1, 45 + y1, 55 + x1, 25 + y1, 42) %.......................Body
drawfillbox (43 + x1, 55 + y1, 57 + x1, 60 + y1, 42) %.......................Hat
drawfillbox (55 + x1, 55 + y1, 65 + x1, 57 + y1, 42) %.......................Hat Lid
drawfilloval (54 + x1, 52 + y1, 1, 1, black) %...............................Eye
drawline (52 + x1, 49 + y1, 55 + x1, 49 + y1, black) %.......................Mouth
Draw.ThickLine (48 + x1, 25 + y1, 46 + x1, 15 + y1, 6, 42) %.................Left Leg
Draw.ThickLine (52 + x1, 25 + y1, 54 + x1, 15 + y1, 6, 42) %.................Right Leg
Draw.ThickLine (55 + x1, 40 + y1, 64 + x1, 38 + y1, 4, 42) %.................Arm
drawfillbox (45 + x1, 30 + y1, 55 + x1, 28 + y1, black) %....................Belt
Draw.ThickLine (58 + x1, 43 + y1, 75 + x1, 43 + y1, 3, 20) %.................Gun
Draw.ThickLine (57 + x1, 42 + y1, 68 + x1, 42 + y1, 3, 138) % ...............Handle
Draw.ThickLine (57 + x1, 40 + y1, 67 + x1, 40 + y1, 4, 138) %................Trigger
end GAMEPIECE1
proc BACKGROUNDLVL1
drawfillbox (0, 0, maxx, maxy, 29) %.........................................LEVEL 1 GRAY BACKGROUND
drawfillbox (0, 65, 50, 55, 22)
drawfillbox (100, 55, maxx, 65, 22)
drawfillbox (0, 130, 450, 140, 22)
drawfillbox (550, 130, maxx, 140, 22)
drawfillbox (0, 205, 50, 215, 22)
drawfillbox (150, 205, maxx, 215, 22)
drawfillbox (0, 270, maxx - 100, 280, 22)
drawfillbox (maxx, 340, 200, 350, 22)
end BACKGROUNDLVL1
proc BACKGROUND1
drawfillbox (1, 1, maxx, maxy, green) %.................................Grass
drawfillbox (50, 50, maxx - 55, maxy - 55, darkgray) %..................Main Building
drawfillbox (25, 25, 125, 125, darkgray) %..............................Bottom left corner
drawfillbox (maxx - 30, 25, maxx - 130, 125, darkgray) %....................Bottom Right corner
drawfillbox (25, maxy - 30, 125, maxy - 130, darkgray) %....................Top left corner
drawfillbox (maxx - 30, maxy - 30, maxx - 130, maxy - 130, darkgray) %......Top
end BACKGROUND1
%*********************************
%
%
%*********************************
%Mainline
%step by step enter the program
View.Set ("graphics,offscreenonly")
cls
loop
Input.KeyDown (chars )
if chars (KEY_UP_ARROW) and whatdotcolor (x, y + 10) = 29 then
y := + 5
end if
if chars (KEY_RIGHT_ARROW) and whatdotcolor (x + 11, y ) = 29 then
x := + 5
show := false
end if
if chars (KEY_LEFT_ARROW) and whatdotcolor (x - 11, y ) = 29 then
x := - 5
end if
if chars (KEY_DOWN_ARROW) and whatdotcolor (x, y - 11) = 29 then
y := - 5
end if
if chars (KEY_ENTER ) then
BACKGROUNDLVL1
t := x + 50
l := y
end if
if x < - 35 %...........................................................LEFT BOUNDARY
then
x := x + 5
end if
if x > 580 %...........................................................RIGHT BOUNDARY
then
x := x - 5
end if
if y > 420 %..............................................................TOP BOUNDARY
then
y := y - 5
end if
if y < - 10 %...........................................................BOTTOM BOUNDARY
then
y := y + 5
end if
BACKGROUNDLVL1
GAMEPIECE (x, y )
drawoval (t - 40, l + 44, 2, 1, black)
if t > 0 and t < maxx then
t - = 5
end if
locate (20, 20)
put x : 5, y : 5
View.UpdateArea (0, 0, maxx, maxy)
delay (10)
cls
end loop
%*********************************
|
|