Results 1 to 4 of 4

Thread: Grids?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Location
    2 miles from everywhere
    Posts
    80

    Grids?

    I have a simple level editor (incomplete) that I'm making for a maze I'm making in Visual C++ (in OpenGL).

    Right now, I am up to the point where I can make lines appear (Will someday be walls!), but they are very unorderly, and there would be holes all over my map.

    I've attached (I think I did, I've never attached a file before) my maze, so you can see what I'm trying to do. I want to know how I could make it snap onto the grid (Right now its just a bunch of blue lines).

    Help would be very appreciated

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Location
    2 miles from everywhere
    Posts
    80

    Ah, I suppose some code may help...

    I forgot to attach/post code, so if you need it here it is.

    Dim Outline1 As Integer
    Dim Outline2 As Integer


    Private Sub cmdA_Click()
    Outline1 = True
    End Sub

    Private Sub Command1_Click()
    Static WallNum As Integer
    WallNum = WallNum + 1
    Load Wall(WallNum)
    Wall(WallNum).X1 = Circle1.Left
    Wall(WallNum).X2 = Circle2.Left ' - 70
    Wall(WallNum).Y1 = Circle1.Top ' - 70
    Wall(WallNum).Y2 = Circle2.Top '- 70
    Wall(WallNum).Visible = True

    End Sub

    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Outline2 = True Then
    Circle2.Top = Y - 70
    Circle2.Left = X - 70
    Outline1 = False
    Outline2 = False
    End If

    If Outline1 = True Then
    Circle1.Top = Y - 70
    Circle1.Left = X - 70
    Outline1 = False
    Outline2 = True
    End If
    End Sub

    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Caption = X & ", " & Y
    End Sub

    Private Sub Timer1_Timer()
    End Sub

    Private Sub mnuExit_Click()
    End
    End Sub

    Private Sub mnuNewMap_Click()
    WallNum = 0
    End Sub

    Private Sub mnuSimpInst_Click()
    MsgBox "To make a wall, click the outline button. Then, click the mouse button twice (different spots on the map for each click) then click create wall... A line will appear. This is a wall. Cant compile yet."
    End Sub

  3. #3
    Addicted Member drewski's Avatar
    Join Date
    Feb 2000
    Location
    WA
    Posts
    242
    Hey dude, are you sure that code is VC++? It sure looks like VB to me. Sorry, I don't know how to fix what you're doing.




    Drewski

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Location
    2 miles from everywhere
    Posts
    80
    The game is VC++, but the level editor is VB
    What I'm trying to do is make it so that the lines that you can place will snap on to a grid.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width