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

Username:   Password: 
 RegisterRegister   
 simple graphics.....i feel stupid
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
void




PostPosted: Tue Apr 08, 2003 6:10 pm   Post subject: simple graphics.....i feel stupid

can anyone give me code that will draw a straight line down the screen....i want it to grow at the top of the screen (maxy) and end at the botton (0 or 1).....the line must be straight and it must be a line that draws itself at one length and after a delay of 10 it redraws over the prvious one...heading in the same direction...and grows...so its like falling from the sky...leaving a streak behind.... thanks alot Laughing
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Tue Apr 08, 2003 10:32 pm   Post subject: (No subject)

there are a few ways to do this the esites amd 1st idea that comes to mind is using the Draw.Dot comand in a for loop

ie.

code:

var i2: int := maxx div 2

for decreasing i : maxy .. 0
    i2 += 1
    Draw.Dot (i2, i, 5)
    delay (10)
end for


you can ajust the agale a bit by chage the amout i2 chages each time.

aloutgh i think that there is a better way to do this maticaky, but i cant think riight now it is latte.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
void




PostPosted: Wed Apr 09, 2003 6:51 am   Post subject: (No subject)

thats the way i did it...but my teaches being a f@g.....its okay...im pretty sure if i hand in the assignment as a standalong he wont bother trying to check the code..muhuhuhuhuahaahahahaha..
Blade




PostPosted: Wed Apr 09, 2003 7:34 am   Post subject: (No subject)

but then... would hee have anything to mark? lol Rolling Eyes
void




PostPosted: Wed Apr 09, 2003 4:04 pm   Post subject: (No subject)

code:

setscreen ("nocursor")
var x, y, button, pb, p_b : int
drawfillbox (maxx, maxy, - 5, - 5, 0)
process crosshair
    loop
        Mouse.Where (x, y, button)
        drawline (x, y, x, y + 20, 256)
        drawline (x - 10, y + 10, x + 10, y + 10, 256)
        delay (10)
        drawline (x, y, x, y + 20, 0)
        drawline (x - 10, y + 10, x + 10, y + 10, 0)
    end loop
end crosshair
process bomb
    loop
        if button = 1 then
            const x1 := x
            const y1 := y
            for a : 1 .. 30
                drawfilloval (x1, y1 + 10, a, a, 256)
                delay (7)
            end for
            delay (100)
            drawfilloval (x1, y1 + 10, 30, 30, 0)
        end if
    end loop
end bomb

function distance (a1, b1, a2, b2 : real) : real
    result ( (a1 - a2) ** 2 + (b1 - b2) ** 2) ** 0.5
end distance

[b]%%REQUIRES DEBUGGIN & EDITTING%
process collission_detection
    randint (p_b, 1, maxx)
    randint (pb, 1, maxy)
    loop
        locate (13, 13)
        put distance (p_b, pb, x, y + 10)
        delay (5)
        if pb = y then
            if p_b = x then
                exit
            end if
        end if
    end loop
    put "HIT"
end collission_detection[/b]
fork collission_detection
fork crosshair
fork bomb

okay....this is what i've done so far....can someone plz change it so that if the randomly selected co-ordinate is hit by my circle then it will say hit :>....thanks a bunch....i've been trying to do this for quite a long time but i cant manage to think lately.... Rolling Eyes i;ve been working on this code and its been the same for the past month...no advancement..so i decide to ask for help......if you copy the code to your comp it wil sho u what kinda game im working on....it will be more advanced in the near future (wit ur help)
Asok




PostPosted: Wed Apr 09, 2003 4:53 pm   Post subject: (No subject)

code:
setscreen ("nocursor")
var x, y, button, pb, p_b : int
drawfillbox (maxx, maxy, - 5, - 5, 0)
process crosshair
    loop
        Mouse.Where (x, y, button)
        drawline (x, y, x, y + 20, 255)
        drawline (x - 10, y + 10, x + 10, y + 10, 255)
        delay (10)
        drawline (x, y, x, y + 20, 0)
        drawline (x - 10, y + 10, x + 10, y + 10, 0)
    end loop
end crosshair
process bomb
    loop
        if button = 1 then
            const x1 := x
            const y1 := y
            for a : 1 .. 30
                drawfilloval (x1, y1 + 10, a, a, 255)
                delay (7)
            end for
            delay (100)
            drawfilloval (x1, y1 + 10, 30, 30, 0)
        end if
    end loop
end bomb

function distance (a1, b1, a2, b2 : real) : real
    result ( (a1 - a2) ** 2 + (b1 - b2) ** 2) ** 0.5
end distance

process collission_detection
    randint (p_b, 1, maxx)
    randint (pb, 1, maxy)
    loop
        locate (13, 13)
        put distance (p_b, pb, x, y + 10)
        delay (5)
        if pb = y then
            if p_b = x then
                exit
            end if
        end if
%-- New Stuff
    if distance (p_b, pb, x, y + 10) = 0 and button = 1 then
    put "HIT"
    end if
        end loop %-- Loop moved to include hit message
end collission_detection

fork collission_detection
fork crosshair
fork bomb


I decided to help you out with this one, here's the code make sure ya understand what's going on. When you click on your randomly selected pixel distance from the pixel is = 0 thus hit.

enjoy Smile
void




PostPosted: Wed Apr 09, 2003 5:35 pm   Post subject: (No subject)

thanks...that is what i was trying to do...i didnt know what parameters to use for the function...i just wrote if distance=0....i assumed the comp knew what i was talking about....but it didnt...so i deleted it and hoped there was an easier way to do it....dont worry....u didnt help an idiot...u helped a temporarily idiot-ified person.... Laughing yeha....im going to take out the randomness thing and attempt to merge that program with my line drawing program...thanks again...its great to have a forum to return to if your teacher wont help you and neither will your brothere whos too busy chatting
Martin




PostPosted: Wed Apr 09, 2003 6:37 pm   Post subject: (No subject)

if you want to have an object that you can hit, just make the if distance (...) to be < 10 for 10 pixels away for example. Although I'm sure that you already knew that
Sponsor
Sponsor
Sponsor
sponsor
void




PostPosted: Wed Apr 09, 2003 7:21 pm   Post subject: (No subject)

yea i did...but thanks any way.... Wink its the thought that counts....my game is almost complete...its prett g@y but otherwise...its playable....im not exactly pro programmer and also..you cant make great games on winOOT...dosOOT in my opinion is better...not as restricted
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: