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

Username:   Password: 
 RegisterRegister   
 Turing worms... Worth a shot?
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Tue Dec 02, 2003 12:30 am   Post subject: Turing worms... Worth a shot?

here's some shit i made up in 1 hour when i was bored and angry... the idea is like worms... to have different gadgets(bombs,missiles,...) and stuffs... right now it's got a simple projectile as grenade...nothing fancy with graphics... NO WHATDOTCOLOR collision detection involved what so ever Laughing ...
but w/e if u guys like it and wanna help me make some nice graphics for the came i could finish it and send u the code to give yer teacher for yer isu... Razz



homer_worms.zip
 Description:

Download
 Filename:  homer_worms.zip
 Filesize:  271.16 KB
 Downloaded:  407 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Tue Dec 02, 2003 1:24 am   Post subject: (No subject)

here's this one with a little bit improvement in projectile movement...


bouncer.zip
 Description:

Download
 Filename:  bouncer.zip
 Filesize:  270.06 KB
 Downloaded:  383 Time(s)

Tony




PostPosted: Tue Dec 02, 2003 10:06 am   Post subject: (No subject)

error on line 61 - picture was not successfuly created Confused (picID = 0)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Homer_simpson




PostPosted: Tue Dec 02, 2003 6:41 pm   Post subject: (No subject)

well cuz u gotto download the pictures that are in the first file first Rolling Eyes
Homer_simpson




PostPosted: Wed Dec 03, 2003 9:12 pm   Post subject: (No subject)

well... since no one's interested...
here's the code:
code:
randomize
View.Set ("graphics:300;300,nobuttonbar")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
type projectile_t :
    record
        sx, sy, x, y, angle, g, vel : real
    end record

var screen : array 1 .. 300, 1 .. 300 of boolean
const maprandomn := 40
const mingh := 50
const maxgh := 60
const maxgd := 6
var x, y, x1, x2, ii := 0
var xs, ys : array 1 .. maprandomn of int
var picID : array 1 .. 100 of int
var proj1 : projectile_t
proj1.sx := 0
proj1.sy := 70
proj1.vel := Rand.Int (20, 80)
proj1.angle := 60
proj1.g := Rand.Int (15, 20)
var time1 := 0.0
picID (3) := Pic.FileNew ("flw.bmp")
picID (4) := Pic.FileNew ("finger.bmp")
procedure Projectile (var obj : projectile_t, t : real)
    obj.x := (obj.vel * cosd (obj.angle) * t) + obj.sx
    obj.y := (obj.vel * sind (obj.angle) * t - obj.g * t ** 2 / 2) + obj.sy
end Projectile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

colorback (black)
cls



xs (1) := 0
xs (maprandomn) := 300

for i : 2 .. maprandomn - 1
    xs (i) := Rand.Int (round ((i - .5) * (300 / maprandomn)), round ((i + .5) * (300 / maprandomn)))
end for
ys (1) := Rand.Int (mingh, maxgh)
for i : 2 .. maprandomn
    ys (i) := Rand.Int (ys (i - 1) - maxgd, ys (i - 1) + maxgd)
end for

for i : 1 .. maprandomn - 1
    drawline (xs (i), ys (i), xs (i + 1), ys (i + 1), 10)
end for
drawfill (10, 0, 10, 10)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Flower%%%%%%%%%%%%%%%
for xxx : 1 .. 300
    for yyy : 1 .. 300
        if whatdotcolor (xxx, yyy) not= black then
            if Rand.Int (1, 900) = 15 then
                %drawfilloval (xxx, yyy, 5, 5, Rand.Int (1, 16))
                case Rand.Int (1, 2) of
                    label 1 :
                        Pic.Draw (picID (3), xxx, yyy, 2)
                    label 2 :
                        Pic.Draw (picID (4), xxx, yyy, 2)

                end case
            end if
        end if
    end for
end for
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Pic.ScreenSave (1, 1, 299, 299, "sc1.BMP")
locatexy ((maxx - 100) div 2, maxy div 2)
color (white)
put "Loading ..."
for xxx : 1 .. 300
    for yyy : 1 .. 300
        if whatdotcolor (xxx, yyy) not= black then
            screen (xxx, yyy) := true
        else
            screen (xxx, yyy) := false
        end if
    end for
end for

for xxx : 1 .. 300
    for yyy : 1 .. 300
        if screen (xxx, yyy) then
            drawdot (xxx, yyy, white)
        else
            drawdot (xxx, yyy, black)
        end if
    end for
end for
View.Set ("offscreenonly")



picID (1) := Pic.FileNew ("gren.bmp")
picID (2) := Pic.FileNew ("sc1.bmp")

cls
procedure updatescreen
    View.Update
    Pic.ScreenSave (1, 1, 299, 299, "sc1.BMP")
    picID (2) := Pic.FileNew ("sc1.bmp")
end updatescreen
loop
    time1 += .05
    Projectile (proj1, time1)
    Pic.Draw (picID (2), 1, 1, 0)
    Pic.Draw (picID (1), round (proj1.x), round (proj1.y), 2)
    locate (1, 1)
    %put round (proj1.x), "/", round (proj1.x)
    if round (proj1.x) < upper (screen, 1) and round (proj1.y) < upper (screen, 2) and round (proj1.y) > 0 and round (proj1.x) > 0 then
        if screen (round (proj1.x), round (proj1.y)) then
            proj1.sx := proj1.x
            proj1.sy := proj1.y
            proj1.vel /= 1.4
            proj1.vel -= 2
            if proj1.vel <= 0 then
                proj1.sx := 0
                proj1.sy := 70
                proj1.vel := Rand.Int (20, 80)
                proj1.angle := 60
                proj1.g := Rand.Int (15, 20)
                time1 := 0.0
                for iii : 1 .. 20
                    drawfilloval (round (proj1.x), round (proj1.y), iii, iii, 12)
                    View.Update
                    delay (5)
                end for
                drawfilloval (round (proj1.x), round (proj1.y), 20, 20, black)
                updatescreen
                for xxx : 1 .. 300
                    for yyy : 1 .. 300
                        if whatdotcolor (xxx, yyy) not= black then
                            screen (xxx, yyy) := true
                        else
                            screen (xxx, yyy) := false
                        end if
                    end for
                end for
            end if



            %proj1.angle -= 1
            %proj1.g := Rand.Int (15, 20)
            time1 := 0.0
        end if
    end if

    if round (proj1.y) <= 0 then
        proj1.sx := 0
        proj1.sy := 70
        proj1.vel := Rand.Int (20, 80)
        proj1.angle := 60
        proj1.g := Rand.Int (15, 20)
        time1 := 0.0
        for iii : 1 .. 20
            drawfilloval (round (proj1.x), round (proj1.y), iii, iii, 12)
            View.Update
            delay (5)
        end for
        drawfilloval (round (proj1.x), round (proj1.y), 20, 20, black)
        updatescreen
        for xxx : 1 .. 300
            for yyy : 1 .. 300
                if whatdotcolor (xxx, yyy) not= black then
                    screen (xxx, yyy) := true
                else
                    screen (xxx, yyy) := false
                end if
            end for
        end for
    end if

    if proj1.x >= upper (screen, 1) then
        proj1.sx := 300
        proj1.sy := proj1.y
        proj1.vel := 0 - (proj1.vel - (proj1.vel / 3))

        time1 := 0.0
    end if


    View.Update
    %cls
end loop
icemaster




PostPosted: Sun Dec 28, 2003 11:55 pm   Post subject: ?

I wonder if anyone's interested in explaining the projectile motion in this program............
PaddyLong




PostPosted: Mon Dec 29, 2003 12:56 pm   Post subject: (No subject)

dude... you should use oop for something like this... it'd be a lot easier to program
Homer_simpson




PostPosted: Mon Dec 29, 2003 6:10 pm   Post subject: (No subject)

hehehe... why man...
this is just a little test for the basics...
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: