
-----------------------------------
Aange10
Sat Sep 03, 2011 10:07 pm

My first game; Paddleball!
-----------------------------------
This is my first game! I hope you guys enjoy! I started programming yesterday, so I think it's in order i give a big THANKS to the players at compsci.ca! Wouldn't have been possible without you!


View.Set("Offscreen, graphics:maxx;maxxy")
var mainmenu : boolean % Using this varriable to tell wether or not to pull up the main menu.
var fontTNR : int % A to allow me to make a font style into a variable
var mainmenuexit : string % The varriable i am using to exit the main meny/ skip past it
var oval_x1,oval_y1,oval_xr1,oval_yr1 : int % I made the drawoval syntax as variables
var oval_speed : int %This is to set my oval's speed
var oval_directionx, oval_directiony : int % To set my ovals trajectory direction
var box1_x1, box1_x2, box1_y1, box1_y2 : int
var chars : array char of boolean % Not sure what this is, just know you have to have it to use keys
var continue : string % Get the y/n asking if the player would like to continue
var score : int % Keeps track of the score
oval_x1 := 70      % the x cord for the ball
oval_y1 := 70      % the y cord for the ball
oval_xr1 := 10     % the radius x for the ball
oval_yr1 := 10     % the radius y for the ball
oval_speed := 2    % the speed of the ball pfp (Pixles per frame ;) )
oval_directionx := 1 % Direction of the x cord of the oval (1 = right, -1 = left)
oval_directiony := 1  % direction of the y cord of the oval ( 1 = up, -1 = down)
box1_x1 := 85 % Box x1 cord
box1_x2 := 200 % box x2 cord
box1_y1 := 20 % box y1 cord
box1_y2 := 40 % box y2 cord
mainmenu := true %a varriable to control the main menu
continue := "y" %a varriable to tell wether or not to continue
score := 0
loop % Main loop
    cls
        loop % main menu debugging loop
            if mainmenu = true then
                fontTNR := Font.New ("TimeNewRoman:14")
                Font.Draw ("Game O' Paddle Ball!", maxx div 2, maxy div 2, fontTNR, green)
                delay (1000)
                fontTNR := Font.New ("Courier:8")
                Font.Draw ("Use AD or Arrow Keys to move! Press b to begin!", maxx div 2 - 100, maxy div 2 - 20, fontTNR, red)
                score := 0 % Just to prevent people from spamming the debug system to gain points
                get mainmenuexit % It asks the user for input
            else 
                exit
            end if
            if mainmenuexit = "b" then %When user inputs b, it changes mainmenu to false so that the loop will skip the main menu if statement
                mainmenu := false
            else
                cls
                put "Invalid key."
                delay (2000)
                exit
            end if
        end loop % Ends the main menu de bugging loop
    cls
    var timestart := Time.Elapsed % So I can measure the time elapsed from this point
    put "Time elapsed:", timestart / 1000 % How much time has elapsed since exiting the menu
    if oval_y1 >= 400 then %if y cord of oval goes >=400 then it inverses the direction of the y
        oval_directiony := oval_directiony * -1
    end if
    if oval_x1 >= 630 then %if the x cord of the oval goes >= 630 then it inverses the direction of the x
        oval_directionx := oval_directionx * -1
    end if
    if oval_x1 