Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Space Game from Grade 10 ICS
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
fishtastic




PostPosted: Thu Dec 27, 2007 8:36 pm   Post subject: Space Game from Grade 10 ICS

Turing:

% --------------------READ!!
%
% A space game by X...
% Special thanks to T... P... for beta testing
% and thanks to the Turing Tutorials on Compsci.
%
% this is the first game I made in turing.
% just copy and paste all these into turing to play
% tested in turing 4.03 and 4.1 and works well
%
% -------------------Controls
% up, down left right to move
% survive as long as you can by dodging flying evil dots
% hack key to discover (or you can simply change my variable)


 


var Scores : array 1 .. 11 of int
var x := round (maxx / 2)
var y := round (maxy / 2)
var tc := 0
var hack := false
var spacex : array 1 .. 1000 of real
var spacey : array 1 .. 1000 of real
var spacexs : array 1 .. 1000 of int
var spaceys : array 1 .. 1000 of int
var key : array char of boolean
var stage := 100
var score := 0.00
var life := 100.0
var name := ""
const UP_ARROW : char := chr (200)
const LEFT_ARROW : char := chr (203)
const RIGHT_ARROW : char := chr (205)
const DOWN_ARROW : char := chr (208)
const SPACE : char := chr (93)
colorback (black)
color (white)
View.Set ("offscreenonly")

procedure genloc
    var temp : int
    var temp2 : int
    for i : 1 .. stage
        randint (temp, 1, 4)
        if temp = 1
                then
            spacex (i) := -200
            randint (spacexs (i), 1000, 3000)
            randint (spaceys (i), -1000, 1000)
            randint (temp2, 1, maxy)
            spacey (i) := round (temp2)
        elsif temp = 2
                then
            spacex (i) := maxx + 200
            randint (spacexs (i), -3000, -1000)
            randint (spaceys (i), -1000, 1000)
            randint (temp2, 1, maxy)
            spacey (i) := round (temp2)
        elsif temp = 3
                then
            spacey (i) := -200
            randint (spaceys (i), 1000, 3000)
            randint (spacexs (i), -1000, 1000)
            randint (temp2, 1, maxx)
            spacex (i) := round (temp2)
        elsif temp = 4
                then
            spacey (i) := maxy + 200
            randint (spaceys (i), -3000, -1000)
            randint (spacexs (i), -1000, 1000)
            randint (temp2, 1, maxx)
            spacex (i) := round (temp2)
        end if
    end for
end genloc
procedure movemap
    for i : 1 .. stage
        drawfillbox (round (spacex (i)), round (spacey (i)), round (spacex (i)) + 1, round (spacey (i)) + 1, yellow)
        spacex (i) := spacex (i) + spacexs (i) / 2000
        spacey (i) := spacey (i) + spaceys (i) / 2000
    end for
end movemap
procedure hitcheck
    for i : 1 .. stage
        if (spacex (i) - x) < 8 and (spacex (i) - x) > -1
                then
            if spacey (i) - y < 8 and spacey (i) - y > -1
                    then
                if hack not= true
                        then
                    life := life - 10
                end if
                colorback (red)
                locate (10, 30)
                put "you got f...ed!!"
                delay (200)
                View.Update
            end if
        end if
    end for
end hitcheck
% main program
loop
    genloc
    tc := 0
    locate (10, 30)
    loop
        colorback (black)
        movemap
        hitcheck
        var COLOUR : int
        randint (COLOUR, 1, 250)
        drawfillstar (x, y, x + 8, y + 8, COLOUR)
        View.Update
        delay (10)
        Input.KeyDown (key)
        if key (UP_ARROW) then
            y := y + 2
        elsif key (DOWN_ARROW) then
            y := y - 2
        elsif key (LEFT_ARROW) then
            x := x - 2
        elsif key (RIGHT_ARROW) then
            x := x + 2
        elsif key (SPACE) then
            var mx, my, mc : int
            mousewhere (mx, my, mc)
            if mx < 10 and my < 50
                    then
                if hack = false
                        then
                    put "hack on!"
                    View.Update
                    delay (1000)
                    hack := true
                else
                    hack := false
                    put "hack off!"
                    View.Update
                    delay (1000)
                end if
            end if
        end if
        %boundary check
        if x < 0
                then
            x := 0
        elsif x > maxx
                then
            x := maxx
        end if
        if y < 0
                then
            y := 0
        elsif y > maxy
                then
            y := maxy
        end if
        cls
        exit when tc = 900
        tc := tc + 1
        life := life + 0.05
        score := score + stage / 200
        put "score:  ", score : 0 : 0, "     life: ", life : 0 : 0 ..
        exit when life < 0
    end loop
    stage := stage + 50
    exit when life < 0
end loop

locate (10, 20)
put "game over!"
View.Update
Sponsor
Sponsor
Sponsor
sponsor
syntax_error




PostPosted: Thu Dec 27, 2007 8:47 pm   Post subject: Re: Space Game from Grade 10 ICS

really nice game
simple yet fun
jsut one thing use code tags next time (?)
maybe if you plan to improve maybe have some dots that give health or something like that?
fishtastic




PostPosted: Thu Dec 27, 2007 9:11 pm   Post subject: Re: Space Game from Grade 10 ICS

syntax_error @ Thu Dec 27, 2007 7:47 pm wrote:
really nice game
simple yet fun
jsut one thing use code tags next time (?)
maybe if you plan to improve maybe have some dots that give health or something like that?


ya i should have some items. my friend told me that too.
Laughing

I am working on another turing game currently.
I will upload it when it is fully done and balanced.
Cant tell you what it is though. XD
Tony




PostPosted: Thu Dec 27, 2007 10:18 pm   Post subject: RE:Space Game from Grade 10 ICS

hey cool, compsci.ca tutorials are attributited in the comments! nice Smile
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
fishtastic




PostPosted: Thu Dec 27, 2007 11:12 pm   Post subject: Re: RE:Space Game from Grade 10 ICS

Tony @ Thu Dec 27, 2007 9:18 pm wrote:
hey cool, compsci.ca tutorials are attributited in the comments! nice Smile


how did my code change from plane text to quoted turing code that looks nicer ?
Tony




PostPosted: Fri Dec 28, 2007 12:02 am   Post subject: Re: Space Game from Grade 10 ICS

you should wrap your code in either [code] [/code] tags or for fancy, language specific highlights like above - [syntax="turing"] [/syntax] tags.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
petree08




PostPosted: Tue Jan 08, 2008 9:59 am   Post subject: RE:Space Game from Grade 10 ICS

hey this is a surprisingly good for a basic looking game. It might be a bit more fun if there were less enemies but the enimeis are bigger.
Sean




PostPosted: Thu Jan 10, 2008 5:19 pm   Post subject: Re: Space Game from Grade 10 ICS

Interesting concept, all though I think you should make some bigger and some smaller, makes it tougher.
Sponsor
Sponsor
Sponsor
sponsor
LaZ3R




PostPosted: Thu Jan 10, 2008 6:27 pm   Post subject: RE:Space Game from Grade 10 ICS

Should've made it so you can move diagonally as well... but oh well, simple and fun :p
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: