Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Newbie - Triangles?

Author
Message
David Bodycombe
22
Years of Service
User Offline
Joined: 29th May 2003
Location:
Posted: 25th Mar 2004 00:00
How do you draw a 2D triangle??? I've got my boxes working OK but I don't understand why it's not a basic 2D command?

Thanks in advance.
comando 300
21
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 25th Mar 2004 00:48
try making 3 lines for each side

CURRENT PROJECT: RETRO PAC-MAN
David Bodycombe
22
Years of Service
User Offline
Joined: 29th May 2003
Location:
Posted: 25th Mar 2004 00:55
Thanks, but I need a filled triangle.

Surely this is possible somehow...?
CloseToPerfect
22
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 25th Mar 2004 02:19
MSPAINT - draw the image
MSPAINT - save the image
DBP - load image
DBP - scale or rotate sprite
DBP - sprite

RGT may be gone but the best DBP forum is still alive and kicking, check it out.
http://www.dannywartnaby.co.uk/rgt/
David Bodycombe
22
Years of Service
User Offline
Joined: 29th May 2003
Location:
Posted: 25th Mar 2004 02:38
I admit that would work to some extent, but it strikes me as using a sledgehammer to crack a nut.

I was able to do triangles on my home micro in 1986. Surely it's possible in 2004?
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 25th Mar 2004 07:28
no no not in 2004 never things have become so complicated you need a IQ of 197 to do the simplest commands =P

The search continues.

Current project - A space game
sprites r us
21
Years of Service
User Offline
Joined: 4th Mar 2004
Location:
Posted: 25th Mar 2004 11:27
you could make a function that "dots" a triangle 1 dot 3 dots 5 dots etc... although rotating it will get hairy but not impossible, if a very little triangle has dot coordinates 1,0;0,1;1,1 then a 45 degree one has 1,0;0,0;1,1.. you could make data lines with the coordinates for each position of the triangle... complicated but you dont need paint...
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 25th Mar 2004 12:28
The funny thing is, everything gets drawn in triangles anyway! A basic poly is a tri, 2 tris make a rectancle. Each sprite is 2 triangles welded together...Try figuring out some really basic 3d commands, they should let you generate a triangle pretty simply, then you just put it in your 2d game at the right place...

GIve me more power!
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 25th Mar 2004 16:09
or you could do what that one guy suggested make a triangle in a program if you want it to be a filled triangle then make a filled triangle in the image program....is that so hard?

The search continues.

Current project - A space game
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 25th Mar 2004 16:18
Yeah, I think hes right though. Ive had loads of problems with the inbuilt line command. It doesnt draw in the correct colour, and even goes all wierd and see thorugh like predator invisibility power. I think the 2d draw commands are a bit dodgy to say the least, so a sprite of a triangle is probably the best option. I guess its a bummer though if you want a really big triangle...

GIve me more power!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Mar 2004 20:16
I wrote this code for someone ... can't remember who though.



There are 3 functions:
1 - Draw triangles with flat top
2 - Draw triangle with flat bottom
3 - Use the above two routines to draw a general triangle

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
David Bodycombe
22
Years of Service
User Offline
Joined: 29th May 2003
Location:
Posted: 27th Mar 2004 04:44
Thanks, that seems to work most of the time, although I did have to play around with the order of the co-ordinates to get it to work properly.

I was doing triangles at regular offsets across the screen (e.g. at x=0, x=100, x=200, x=300 etc.) but one of the points was always sticking to the first triangle's coordinates, if you see what I mean.

Login to post a reply

Server time is: 2025-06-30 10:49:57
Your offset time is: 2025-06-30 10:49:57