Triangle movement

myblueocean

Well-known member
Joined
Jun 29, 2007
Messages
161
Location
England
Programming Experience
Beginner
VB.NET:
'Triangle code.
        'Left side 1 line.
        e.Graphics.DrawLine(Pens.White, 25, 30, 57, 57)

        'Right Side 2 line.
        e.Graphics.DrawLine(Pens.White, 20, 40, 57, 57)

        'Base line (3), bottom of triangle.
        e.Graphics.DrawLine(Pens.White, 20, 38, 27, 30)

        'Back line of triangle.
        e.Graphics.DrawLine(Pens.White, 20, 38, 27, 30)
        '^Triangle code.

How do i go about moving this triangle with any four buttons of my choice? Left, "A".
 
To draw a triangle you need only 3 Point variables, drawing three lines between them. To "move" it you offset these 3 Points, see this thread, it is same functionality.
 
Um, I don't know how to do that?

Can you give me some pointers please?

I'm a little rusty on this whole subject, so a little patience might be needed with me...thank you.
 
You do know how to do it, it was explained to you many times in the thread I linked. Apart from that you were also explained how to do it in this thread, it is no different. Even if you don't understand VB.Net code or what people are explaining you still have enough pointers to find more resources about this to learn from.
 
Maybe I should just keep talking again for my own sake...

Alright, this code here.

And also when I said i was rusty meaning I haven't had access to the web or used a pc as usual...

'Draw the Rectangle.
e.Graphics.DrawRectangle(Pens.White, Me.rect)
'Fill the rectangle.
e.Graphics.FillRectangle(Brushes.White, Me.rect)

How would you move that left or right with any button?

When you just go to "method" and select key down the rectangle moves down, but then if you press left arrow key or right it does the same. When really that shouldn't happen?

So what to I add to the code, this just seems all over the place.
 
May be sometime in future someone will write up a tutorial on 2D game creation. I have also found a curiousity for that.:confused:
 
How do I make these three points???

I'm in the clouds about this.
 
So how would you make a triangle move around in VB?

How many different ways of doing this?;)
 
"To draw a triangle you need only 3 Point variables, drawing three lines between them."

Three points? Just make three pixels?
 
So how would you make a triangle move around in VB?
2d or 3d?
Winforms, GDI or WPF?
Using DirectX?
 
I might as well add this here, I'm just going to pack my project file onto a floppy disk. And give this ago some other time...

I'm not refering to this simple task, just the 2D game thing.
 
"DiskJunky"

Straight, left, right. Really, by turning left or right you should move in any path because of the left and right.

And I'm sticking to 2D, why 3D. I hardly can do much in VB...;)
 
Back
Top