
-----------------------------------
Chris Pain
Fri Oct 27, 2006 8:43 pm

Gaming Help!!!
-----------------------------------
Hmm well i'm new here. So, HI! it's nice to meet you all. I'm doing this project for a gr11 class. We need to basically make a game. Now i found this code on this forum, and want to further develop it. and i seriously hate turing and i know nothing of it, so i need you're help please!

1. Are all the comments right about what the actual code does?

2. how can i insert the bottom code into the 1st to make it run properly. i've tried to actually just put the variables, procedure and run the 
procedure where draws is, but the screen becomes blank :(

3. Can someone PLEASE tell me how to put boundaries. Basically i would like this to have the stick figure jumping over the lines, and if it hits them, you lose.


----CODE FOUND-----
var x, y, spd, check : int 
% var for input.keydown (key)
var key : array char of boolean 
setscreen ("graphics,offscreenonly") 
%sets variables x and y
x := 10 
y := 50 
%the stick man, and bottom line 
procedure draw 
    %head
    drawoval (x, y, 10, 10, black) 
    
    %body
    drawline (x, y - 10, x, y - 30, black) 
    
    %leg
    drawline (x, y - 30, x - 10, y - 40, black)
    
    %leg 
    drawline (x, y - 30, x + 10, y - 40, black) 
    
    %arms
    drawline (x - 10, y - 20, x + 10, y - 20, black) 
    
    %bottom of screen line
    drawline (1, 10, maxx, 10, black) 
    
end draw 
%draw procedure (stick figure + bottom line)
draw 
%var check = how high thefigure can go (0)
check := 0 
%var spd = gravity force (0)
spd := 0 
loop 
    View.Update 
    
    %sets key as var for key pressed
    Input.KeyDown (key) 
    
    %check is preset to 0
    if check = 0 then 
    
        %if w is pressed (Input.KeyDown), spd = 32 and check = 0
        if key ('w') then 
            
            %var spd = 32
            spd := 32 
            
            %var check = 0
            check := 0 
            
        end if 
        
    end if 
    
%Moves Horizontally
    
    %d is pressed
    if key ('d') then 
    
        %moves figure 5 to the right
        x := x + 5 
        
    %a is pressed     
    elsif key ('a') then 
        
        %moves figure 5 to the left
        x := x - 5 
        
    end if
    
%height of jump
    %once y= more then 51 check = 1 
    if y >= 51 then 
    
        check := 1 
       
    % if y = 50 then check = 0
    elsif y = 50 then 
    
        check := 0 
        
    end if 
    
%controls the rate of fall (gravity)
    %divides spd by 2 if greater than 0
    if spd > 0 then 
        spd := spd div 2 
        
    elsif spd < 0 then 
    
        
        spd := spd * 2 
    end if 
    
    % if spd = 1 then it is = to -1
    if spd = 1 then 
        spd := -1 
    end if 
    
    % adds gravity to var y
    y := y + spd 
    
    %sets gravity (spd) to 0 when y = less than 50. 
    %if y is more than 50, then y always increases (keeping the figure afloat)
    if y 