Help in making a triangle...
Author 
Message 
1337

Posted: Tue Jun 01, 2004 8:50 pm Post subject: Help in making a triangle... 


I know you have to use lines for the triangle, but I tried alot of different numbers and can't figure it out.
Basically, I want it to look like this:
_
 _
 

Well I'm not a good drawer but the 2 vertices pointing left. They should include the x and y coordinates as it's controlled when I'm making my shooting game.
Thanks, 





Sponsor Sponsor



Paul

Posted: Tue Jun 01, 2004 8:53 pm Post subject: (No subject) 


huh? Your picture didn't exactly look like a triangle, do you mean just a triangle with one of it's point pointing directly right? 





1337

Posted: Tue Jun 01, 2004 8:55 pm Post subject: (No subject) 


Yeah, sorry, I suck at drawing :\
 _
 _
 _
 





Paul

Posted: Tue Jun 01, 2004 8:57 pm Post subject: (No subject) 


huh wha?
anyway tell me if this is close
code: 
var x: array 1..3 of int:=init (100, 100, 300)
var y: array 1..3 of int:= init (100, 300, 200)
drawpolygon (x,y,3,12)

so it draws a triangle with vertices (100,100) , (100, 300), (300, 200) 





Tony

Posted: Tue Jun 01, 2004 8:58 pm Post subject: (No subject) 


delta's Pic~2~Code is always useful...
otherwise
code: 
var x, y, b : int
loop
Mouse.Where (x, y, b)
Draw.Line (x, y, x + 50, y + 50, black)
Draw.Line (x + 50, y + 50, x, y + 100, black)
Draw.Line (x, y + 100, x, y, black)
end loop


Tony's programming blog. DWITE  a programming contest. 




SuperGenius

Posted: Tue Jun 01, 2004 8:59 pm Post subject: (No subject) 


to make a triange you need 3 seperate drawline statements. each x and y pair of coords will have to be used twice... so:
code: 
var x, y : array 1 .. 3 of int
x (1) := 10
y (1) := 10
x (2) := 10
y (2) := 100
x (3) := 150
y (3) := 50
Draw.Line (x (1), y (1), x (2), y (2), black)
Draw.Line (x (2), y (2), x (3), y (3), black)
Draw.Line (x (1), x (1), x (3), y (3), black)
Draw.Line (10, 10, 10, 100, black)
Draw.Line (10, 100, 150, 50, black)
Draw.Line (10, 10, 150, 50, black)

both of these groups of 3 drawline statements do the same thing. 





SuperGenius

Posted: Tue Jun 01, 2004 9:00 pm Post subject: (No subject) 


oops, it seems I have been beaten to the answer... 





1337

Posted: Tue Jun 01, 2004 9:01 pm Post subject: (No subject) 


Well, I'm making a game and the x y coordinates should be controlled by my down and up arrow.
Can you post how it should look like before Input.KeyDown (chars), etc.
BTW:
x := 10
y := 25
And also, can you make it smaller? Like 1/4th its size.
thanks again 





Sponsor Sponsor



Tony





Paul

Posted: Tue Jun 01, 2004 9:14 pm Post subject: (No subject) 


1337 wrote: Well, I'm making a game and the x y coordinates should be controlled by my down and up arrow.
Can you post how it should look like before Input.KeyDown (chars), etc.
BTW:
x := 10
y := 25
And also, can you make it smaller? Like 1/4th its size.
thanks again
well what u can do is make one set of values variables, then make all other values dependent on your one set, that way when one changes, all will change. 





1337

Posted: Wed Jun 02, 2004 5:59 pm Post subject: (No subject) 


var x, y, b : int
loop
View.Update
cls
Mouse.Where (x, y, b)
Draw.Line (x, y, x + 50, y + 50, 78)
Draw.Line (x + 50, y + 50, x, y + 100, 78)
Draw.Line (x, y + 100, x, y, 78)
end loop
Okay, I got that, but now I want to know how to make it so that out of the triangle, red dots start shooting, while it moves with the mouse. Do you use drawline or drawdot, can you show a good example? After that, I want to know how to make ovals in random places through the screen. After that, I'll try to do collision and things, if I need more help I'll ask again
Thanks again. 





Cervantes

Posted: Wed Jun 02, 2004 7:59 pm Post subject: (No subject) 


1337 wrote: Do you use drawline or drawdot
1337 wrote: red dots start shooting
drawdot
though if you want the dots to stay on the screen, you could use either. also, if you want the dots to be larger then 1x1 pixels, use drawfilloval.
as for how: if you're shooting out 1 dot then
code: 
if button pressed then
button_pressed := true
end if
if button_pressed = true then
red_dot_x += 1
red_dot_y += 1
drawdot (red_dot_x,red_dot_y, blue) :lol:
end if

I'm not sure how you want the red dots to shoot out though. maybe you want one to shoot from each side and to go with slopes of 1 and negative 1. 





1337

Posted: Thu Jun 03, 2004 10:51 pm Post subject: (No subject) 


I tried collision when it reaches maxx, but it doesn't seem to work. Any help?
code: 
loop
cls
Mouse.Where (x, y, b)
for a4 : 1 .. 10
x4 (a4) = 3
if x4 (a4) < 30 then
loop
EXIT := true
x4 (a4) := Rand.Int (maxx, maxx + 700)
y4 (a4) := Rand.Int (0, maxy)
for c : 1 .. a4  1
if MathDistance (x4 (a4), y4 (a4), x4 (c), y4 (c)) < 60 then
EXIT := false
end if
end for
exit when EXIT = true
end loop
end if
setscreen ("offscreenonly")
Pic.Draw (picture, x4 (a4), y4 (a4), picMerge)
Pic.ScreenLoad ("unit.bmp", x, y, picCopy)
end for
View.Update
end loop
delay (150)
cls
end if 






.hack

Posted: Sun Jun 06, 2004 4:58 pm Post subject: (No subject) 


if ur making a triangle..go into paint, draw ur triangle,m save it and import it thru GUI? Its not very hard to do, just check out the manual in Turing, Help > "Turing Reference" I believe. Its a basic command..I jsut forget what it is lo
Pic.FileNew App5:("C:\TriangleOF133.JPG)
or something to taht effect. 





1337

Posted: Sat Jun 12, 2004 9:25 pm Post subject: (No subject) 


Also, I was wondering how you can use Mouse.Where and drawlines so that you can picture a bullet.
Like:
> = ship
> . . . . (and the rest behind goes out)
Kinda like this guys: http://www.compsci.ca/v2/viewtopic.php?t=1340
Thanks again! 






