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

Username:   Password: 
 RegisterRegister   
 4-in-1
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
guttface




PostPosted: Fri Mar 11, 2005 6:44 pm   Post subject: 4-in-1

heres a 4 in 1 that include space inavder, helicopter, sanke, and whak a mole (whi ive posted in the past). u need to have all the images in the same directory as the program.


Summative.zip
 Description:

Download
 Filename:  Summative.zip
 Filesize:  64.49 KB
 Downloaded:  281 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Token




PostPosted: Fri Mar 11, 2005 10:46 pm   Post subject: (No subject)

Well, this was pretty cool, i couldent find any glitches accept for the snake game you can run into the walls, i realise this was intentional on your part and it was very well done but the traditional snake game has walls that you colide with, other than that i found it very well done and i bet you got a great mark on this FSE keep it up
Bacchus




PostPosted: Sat Mar 12, 2005 12:49 am   Post subject: (No subject)

in the space invaders, if u fire to much it gets error
ssr




PostPosted: Sat Mar 12, 2005 12:45 pm   Post subject: (No subject)

lol thats nice games eh
just one bitty advice
in ur heliocopter game, it dhould draw a parabola instead of just going up and down, Very Happy

but really nice games Very Happy
Naveg




PostPosted: Sat Mar 12, 2005 4:38 pm   Post subject: (No subject)

Fantabulous!
GlobeTrotter




PostPosted: Sat Mar 12, 2005 11:19 pm   Post subject: (No subject)

I made some small edits to the helicopter game to make the motion parabolic.

code:

procedure helicoptergame %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %reset screen
    View.Set ("graphics:400;300,position:middle;center,title:Helicopter Game,nocursor,noecho,offscreenonly,noecho")

    %reset variables
    x := 211
    y := 150
    howmany := 1
    over := false
    under := 4
    score := 0
    fontID := Font.New ("Sans Serif:14:bold")
    continue := "q"
    block (1).y := 400
    block (2).y := 400
    block (1).x := maxx
    streamNumber := -1
    filename := "helicopter"
    scorerank := 11
    for i : 0 .. 47
        wall (i).x := i * 50
        wall (i).y := num (i)
    end for

    colour (0)
    colourback (7)
    cls

    %display welcome screen
    put "WELCOME TO THE HELICOPTER GAME!", skip
    put "The object of the game is to get as far into the"
    put "tunnel as possible, without crashing. To move"
    put "higher, hold down the mouse button. To fall,"
    put "release it. The game ends when you hit the roof,"
    put "ground, or the obstacles. Good luck!", skip
    put "Press ENTER to continue." ..
    View.Update

    loop
        Input.getch (continue)
        exit when continue = chr (10)
    end loop
    View.Set ("nocursor")
    cls
    View.Update

    %draw screen and wait for mouse click before starting
    for i : 0 .. 47
        Draw.FillBox (wall (i).x, 0, wall (i).x + 49, wall (i).y, 47) %draw floor
        Draw.FillBox (wall (i).x, maxy, wall (i).x + 49, maxy - (75 - wall (i).y), 47) %draw ceiling
    end for
    Font.Draw ("CLICK TO START", 20, 144, fontID, 0)
    Draw.FillOval (x, y, 10, 10, 53)
    Font.Draw ("Distance: " + realstr (score, 0), 1, 1, fontID, 0)
    Font.Draw ("Best: " + intstr (best), 200, 1, fontID, 0)
    View.Update
    loop
        exit when Mouse.ButtonMoved ("down")
    end loop

    %at the beginning of each loop, a new obstacle (block) is created
   
    var yspeed : real
    var tempy : real
    yspeed := 0
    tempy := y
   
   
    loop
        block (2).x := maxx %set new block's x coordinate
        if howmany = 2 then
            %only set new block's y coordinate, if it is not the beginning of the game, and there are therefore 2 blocks on screen. At the beginning of the game, there are not any on screen blocks.
            block (2).y := Rand.Int (75, 164)
        end if
        for i : 1 .. 125
            if i rem 25 = 0 then %every 25 times through the loop, a new wall section moves under the player
                under += 1
            end if
            %DATA INPUT SECTION
            Mouse.Where (x1, y1, button) %get button status, and change the user's direction accordingly
            %CALCULATION SECTION
            if button = 0 then
                yspeed -= 0.03
            elsif button > 0 then
                yspeed += 0.03
            end if
                tempy += yspeed
                y := round (tempy)
            %OUTPUT SECTION
            cls
            for i1 : 1 .. 2 % change blocks' coordinates and redraw then
                block (i1).x -= 2
                Draw.FillBox (block (i1).x, block (i1).y, block (i1).x + 20, block (i1).y + 60, 47)
            end for
            for i1 : 0 .. 47 %change all the wall sections' coordinates and redraw them
                wall (i1).x -= 2
                Draw.FillBox (wall (i1).x, 0, wall (i1).x + 49, wall (i1).y, 47)
                Draw.FillBox (wall (i1).x, maxy, wall (i1).x + 49, maxy - (75 - wall (i1).y), 47)
            end for
            Draw.FillOval (x, y, 10, 10, 53) %redraw user, as well as new distance and best distance (it has not changed, but screen has been cleared (cls)
            Font.Draw ("Distance: " + realstr (round (score), 0), 1, 1, fontID, 0)
            Font.Draw ("Best: " + intstr (best), 200, 1, fontID, 0)
            View.Update
            %CALCULATION SECTION 2
            %check if user hits block 2's (block 1 is behind the user already) front, top or bottom, or the walls bellow, on top, the next wall bellow and on top, as well as the "cliff" between the 2 wall sections
            if Math.DistancePointLine (x, y, block (2).x, block (2).y, block (2).x, block (2).y + 60) < 13 or
                    Math.DistancePointLine (x, y, block (2).x, block (2).y + 60, block (2).x + 20, block (2).y + 60) < 13 or
                    Math.DistancePointLine (x, y, block (2).x, block (2).y, block (2).x + 20, block (2).y) < 13 or
                    Math.DistancePointLine (x, y, wall (under).x, wall (under).y, wall (under).x + 49, wall (under).y) < 12 or
                    Math.DistancePointLine (x, y, wall (under + 1).x, wall (under + 1).y, wall (under + 1).x + 49, wall (under + 1).y) < 12 or
                    Math.DistancePointLine (x, y, wall (under).x + 50, wall (under).y, wall (under + 1).x, wall (under + 1).y) < 12 or
                    Math.DistancePointLine (x, y, wall (under).x, maxy - (75 - wall (under).y), wall (under).x + 49, maxy - (75 - wall (under).y)) < 12 or
                    Math.DistancePointLine (x, y, wall (under + 1).x, maxy - (75 - wall (under + 1).y), wall (under + 1).x + 49, maxy - (75 - wall (under + 1).y)) < 12 or
                    Math.DistancePointLine (x, y, wall (under).x + 50, maxy - (75 - wall (under).y), wall (under + 1).x, maxy - (75 - wall (under + 1).y)) < 12 then
                over := true
                exit
            end if
            Time.Delay (10)
            if wall (47).x = 350 then %if all walls have been displayed then reset their x coordinates and start displaying the wall sections again
                for i1 : 0 .. 47
                    wall (i1).x := i1 * 50
                end for
                under := 4 %reset which wall section is under the user
            end if
            score += 0.5
        end for
        if over = true then % if user crashed, draw "crash ovals", update the best score, reset variables, and prepare for next round
            for i : 1 .. 5
                Draw.Oval (x, y, 10 + 5 * i, 10 + 5 * i, 12)
                View.Update
                Time.Delay (100)
            end for
            Time.Delay (2000)
            if score > best then
                best := round (score)
            end if
            y := 150
            tempy := y
            yspeed := 0
            howmany := 1
            over := false
            under := 4
            score := 0
            block (1).y := 400
            block (2).y := 400
            block (1).x := maxx
            for i : 0 .. 47
                wall (i).x := i * 50
                wall (i).y := num (i)
            end for
            %redraw screen for next round
            cls
            for i : 0 .. 47
                Draw.FillBox (wall (i).x, 0, wall (i).x + 49, wall (i).y, 47)
                Draw.FillBox (wall (i).x, maxy, wall (i).x + 49, maxy - (75 - wall (i).y), 47)
            end for
            Font.Draw ("CLICK TO START", 20, 144, fontID, 0)
            Draw.FillOval (x, y, 10, 10, 53)
            Font.Draw ("Distance: " + intstr (score div 2), 1, 1, fontID, 0)
            Font.Draw ("Best: " + intstr (best), 200, 1, fontID, 0)
            View.Update
            %get mouse click to start, or the ESC key to quit
            loop
                Mouse.Where (x1, y1, button)
                exit when button > 0
                if hasch then
                    getch (continue)
                    if continue = chr (27) then
                        over := true
                        exit
                    end if
                end if
            end loop
        end if % end of "crashed" section
        exit when over = true
        block (1) := block (2) %set block 1 to block 2, as new block 1 will be created at top of loop
        if howmany = 1 then %if game has just  begun, and there is only 1 block on screen, there will now be 2
            howmany += 1
        end if
    end loop

    %HIGH SCORE SECTION AND CONCLUSION
    cls
    View.Set ("title:THANKS FOR PLAYING")
    %if old score file exists, open it and save its values
    open : streamNumber, "." + filename, get
    if streamNumber > 0 then
        for i : 1 .. 10
            get : streamNumber, hiscore (i)
        end for
        for i : 1 .. 10
            get : streamNumber, hiscorer (i) : *
        end for
        close : streamNumber
    else % if old file doesn't exist then create new values
        for i : 1 .. 10
            hiscore (i) := 1000 * (11 - i)
        end for
        for i : 1 .. 10
            hiscorer (i) := "Matt Guttman"
        end for
    end if

    for decreasing i : 10 .. 1 %determine if user score is in the top 10 and if so, get its rank
        if best > hiscore (i) then
            scorerank := i
        end if
    end for

    if scorerank < 11 then % if user gets a high score, move the existing high scores and scorers below the user's score down 1 place
        for decreasing i : 10 .. 1
            ioutofloop := i
            exit when scorerank = i
            hiscore (i) := hiscore (i - 1)
        end for
        hiscore (ioutofloop) := best
        for decreasing i : 10 .. 1
            exit when scorerank = ioutofloop
            hiscorer (i) := hiscorer (i - 1)
        end for
        hiscorer (ioutofloop) := name
    end if

    %display user score and high scores
    cls
    locate (1, (maxcol div 2) - 4)
    put "GAME OVER", skip
    if scorerank < 11 then
        put "Your score: ", best, "   NEW HIGH SCORE #", scorerank, "!"
    else
        put "Your score: ", best
    end if
    locate (5, (maxcol div 2) - 5)
    put "HIGH SCORES", skip

    for i : 1 .. 10
        put hiscorer (i) : 20, hiscore (i)
    end for

    open : streamNumber, "." + filename, put %save new high scores
    assert streamNumber > 0
    for i : 1 .. 10
        put : streamNumber, hiscore (i)
    end for
    for i : 1 .. 10
        put : streamNumber, hiscorer (i)
    end for
    close : streamNumber

    put skip, "Press any key to quit." ..
    View.Update

    getch (continue)

    %prepare screen for main program view
    cls
    View.Set ("graphics:500;500,title:4-in-1,nocursor,noecho,position:centre;middle,offscreenonly")
    Pic.Draw (mainprogrampic1, 0, 0, 1)
    Pic.Draw (mainprogrampic2, 250, 0, 1)
    Pic.Draw (mainprogrampic3, 0, 250, 1)
    Pic.Draw (mainprogrampic4, 250, 250, 1)
    View.Update

end helicoptergame %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ssr




PostPosted: Sun Mar 13, 2005 8:38 pm   Post subject: (No subject)

much much better
by the way, can u make the distance between the rocks a bit longer, its kinda hard now...
Very Happy
guttface




PostPosted: Sun Mar 13, 2005 9:19 pm   Post subject: (No subject)

thanks for the feedback. i like the parabolic edit globetroter. i tried to do that but ran out of time at the end of the year. to make it run properly you have to copy
code:
yspeed := 0
tempy := y
to the section that resets varibale for the next round. also, i find it a little easier if you change
code:
elsif button > 0 then
yspeed += 0.03
to
code:
elsif button > 0 then
yspeed += 0.05
thanks again for the feedback and nice job on the copter fix.
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Mon Mar 14, 2005 2:36 am   Post subject: (No subject)

ssr wrote:
much much better
by the way, can u make the distance between the rocks a bit longer, its kinda hard now...
Very Happy


Really? I did better now.

Helicopter Score: 2325 (or something in the 2300's)
Snake Score: 4600
Whackamole : 5800
guttface




PostPosted: Mon Mar 14, 2005 6:56 pm   Post subject: (No subject)

this is awesome- ppl are actualy playing my games. if anyone coud come up with a way to make space invaders more effecient (not slow down when too many shots are fired) i'd really apreciate it. i have a feeling if the number of Math.Distance and Math.DistancePointLine were limited it would help, but i don't know any other way of determining the distance between the bullet and the enemy.
PolishPunk7




PostPosted: Wed Mar 23, 2005 6:55 pm   Post subject: (No subject)

hey sounds like a good game (from what i read, and the programing text) but i cant run it, cause im getting errors with every line that has :

- DistancePointLine

- Distance

anyone know why i could be getting these errors with those lines?
Token




PostPosted: Wed Mar 23, 2005 7:06 pm   Post subject: (No subject)

its most likely because you dont have a very recent version of turing, so any math functions w/ distance, or any math functions at all... hmm i'm not sure, but ne ways they wont work w/ older versions
PolishPunk7




PostPosted: Thu Mar 24, 2005 10:14 pm   Post subject: (No subject)

whats the newest verson of turing thats out? i have verson 4.0.4c
guttface




PostPosted: Fri Mar 25, 2005 1:12 pm   Post subject: (No subject)

i have 4.0.5
post8k




PostPosted: Fri Mar 25, 2005 5:10 pm   Post subject: (No subject)

Amazing program....
especially with the space ship that shoots... with the money, you become addicted to it... LOL





gj
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  [ 15 Posts ]
Jump to:   


Style:  
Search: