Welcome to Phrogram Sign in | Join | Help


How to write a number in a square as a polygon (sprite-style)?

  •  03-20-2008, 7:48 PM

    How to write a number in a square as a polygon (sprite-style)?

    I am trying to display a polygon (in floating mode, like a sprite), which is easy. What I'm stuck on, is trying to separately add a label (eg a number) onto the polygon, so that travels with it.

    But my first problem is just getting my number to display. Why doesn't this display a number on a square?

    Program SquareWithLabel

        Method Main()

            // draw square
            Define square As Polygon       
            square.AddPoint(0,0)
            square.AddPoint(0, 50)
            square.AddPoint(50, 50)
            square.AddPoint(50, 0)
            square.Color = Colors.Gray
            square.IsFloating = True
            square.X = ScreenWidth() /2
            square.Y = ScreenHeight() /2
            square.Draw()
           
            // draw number 1 in the middle of the square
            Define num As Polygon
            num.AddPoint(0, 0)
            num.AddPoint(2, 0)
            num.AddPoint(2, 16)
            num.AddPoint(0, 16)
            num.Color = Colors.Blue
            num.Filled = True
            num.IsFloating = True
            num.X = square.X
            num.Y = square.Y
            num.SetParent(square)
            num.Draw()

        End Method

    End Program
     

    Filed under: ,
View Complete Thread