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

Username:   Password: 
 RegisterRegister   
 [Game] copter
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Thuged_Out_G




PostPosted: Fri Mar 19, 2004 2:06 am   Post subject: [Game] copter

well, here is my copter version lol. im open for suggestions...nothing to complicated, i just say a post someone wanted to find a turing version of it, so i decided to make it cause i was bored lol


copter.zip
 Description:

Download
 Filename:  copter.zip
 Filesize:  3.22 KB
 Downloaded:  439 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Fri Mar 19, 2004 10:45 am   Post subject: (No subject)

Amusing.

But, please, please add a delay factor to it. Preferably a changeable one.

eg.
when declaring your vars, add one more:

code:

var delSp : int := 10
%...rest of your code until...
% View.Update, then
delay (delSp)


That way one can actually see what is happening on faster computers.

By having it a quick and dirty var in the beginning, ppl can change it to suit their (and their comps) needs.

Otherwise...try looking into curved motion for the helicopter. That and the classic fumes coming out of the engine...otherwise it works pretty well.

edit:
Ok, scratch that 'it works pretty well' part. I just realised that if you travel a bit above an obstacle, it considers it a crash, even though you were clearly above it.
Should be more than a case of changing your collision-detection points.
AsianSensation




PostPosted: Fri Mar 19, 2004 12:59 pm   Post subject: (No subject)

yeah, whatdotcolor detection isn't that good. I saw your collision thingie, I think you are checking the front corners only? Because I had the chopper's tail pass through the walls. Try using math instead, it might work better.
Thuged_Out_G




PostPosted: Fri Mar 19, 2004 1:53 pm   Post subject: (No subject)

ok, i ditched the whatdotcolor collision detection, gave a shot with the Math.DistancePointLine i think it works a bit better Razz lol
also, added the delay delos asked for, just change the pauseTime var value.

i think in the original copter, they helicopter didnt actually move in a curved motion, but it was the background moving, and the smoke just came out behind the copter, and then went off with the background.
anything else i can improve upon, let me know...im going to attempt to add smoke

code:

module copLevelOne
    import Mouse, Math
    export moveShip, Bval, game, endGame

    var win := Window.Open ("title:Copter, nobuttonbar, max,max")
    var x, y, x1, y1, button : int
    var pic := Pic.FileNew ("chopper2.JPG")
    var pic1 := Pic.FileNew ("chopper.JPG")
    var count := 0
    var distance : real := 0.0
    var bx1, by1, bx2, by2 : int
    var radius := 10
    var times : int
    var pauseTime := 0 %set your delay time here
    var obj : int := 0
    var levelFlag : boolean := false

    setscreen ("offscreenonly")

    x := maxx div 2
    y := maxy div 2 - 20

    proc moveShip
        Pic.Draw (pic1, x, y, picMerge)
        Mouse.Where (x1, y1, button)
        if button = 1 then
            y += 1
            count := 0
        elsif count >= 10 then
            y -= 2
            count += 1
        elsif count >= 20 then
            y -= 5
            count += 1
        else
            y -= 1
            count += 1
        end if
    end moveShip

    proc Bval
        obj += 1
        bx1 := maxx - 10
        by1 := Rand.Int (50, maxy - 110)
    end Bval
    Bval

    proc endGame
        cls
        put "YOU CRASHED!!!"
        put "----------------------------------------"
        put "You made it: ", distance, " meters"
        put "You played for: ", times / 1000, " seconds"
        put "You dodged a total of: ", obj, " objects"
        put "----------------------------------------"
        put "Thank you for playing Turing Copter"
    end endGame


    proc game
        loop
            clock (times)
            distance += .2
            cls
            Draw.FillBox (0, 50, maxx, maxy - 50, black)
            moveShip
            if bx1 = 0 then
                Bval
            end if
            Draw.FillBox (bx1, by1, bx1 + 20, by1 + 110, 10)
            if Math.DistancePointLine (x + Pic.Width (pic), y + Pic.Height (pic), bx1, by1, bx1 + 20, by1 + 110) < 1 then
                Pic.Draw (pic, x, y, picCopy)
                endGame
                exit
            elsif whatdotcolor (x + Pic.Width (pic), y + Pic.Height (pic)) = white then
                Pic.Draw (pic, x, y, picCopy)
                endGame
                exit
            elsif whatdotcolor (x, y) = white then
                Pic.Draw (pic, x, y, picCopy)
                endGame
                exit
            end if
            bx1 -= 1
            locate (1, maxrow)
            put "Distance: ", distance, " metres"
            if distance >= 1000 then
                cls
                put "You Made It to Level 2!!!"
                levelFlag := true
                exit
            end if
            delay (pauseTime)
            View.Update
        end loop
    end game
end copLevelOne
copLevelOne.game
sport




PostPosted: Sat Mar 20, 2004 1:11 pm   Post subject: (No subject)

How about a help file?
Thuged_Out_G




PostPosted: Sat Mar 20, 2004 3:14 pm   Post subject: (No subject)

a help file for what?
click the mouse the make copter go up, let go to go down....what else would you like to know?
Thuged_Out_G




PostPosted: Sat Mar 20, 2004 3:17 pm   Post subject: (No subject)

about the collision detection happening when you are just above the wall. i believe that is because, the picture of the copter is a square, so where you see the copter, the picture actually is bigger. so you thought you were in the clear, but really the picture still hit it. i believe the collisions work better now, any other suggestions or better collision detection im all ears
the_short1




PostPosted: Sat Mar 27, 2004 12:03 pm   Post subject: (No subject)

ok a few things...


for one the second picture of the copter crashing does nto every acaully show.. i changed this part of code to that and it still wont show... WTH!Confused!

if Math.DistancePointLine (x + Pic.Width (pic), y + Pic.Height (pic), bx1, by1, bx1 + 20, by1 + 110) < 1 then
Pic.Draw (pic, x, y, 2)
delay (1000)
endGame
exit
elsif whatdotcolor (x + Pic.Width (pic), y + Pic.Height (pic)) = white then
Pic.Draw (pic, x, y,2)
delay (1000)
endGame
exit
elsif whatdotcolor (x, y) = white then
Pic.Draw (pic, x, y, 2)
delay (1000)
endGame
exit
end if

fun game... but a little to slow... even though the delay was set to 0.... hows that??? i have a realy slow comp... but still... JEEZE!...

ok.. another thing is... for your picture problem (running into it when u didn;t).. maybe try a program like irfanview and crop it down to just the chopper...


Good program all in all + 5 bits
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: