
-----------------------------------
Salman
Wed Jan 16, 2013 11:37 am

Text appear over box
-----------------------------------
What is it you are trying to achieve?
Trying to make the text on the red area

What is the problem you are having?
When I try to draw it,it doesn't appear

Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
import GUI
var x2 := maxx div 2
var y2 := maxy div 2
const radius := 10
var speedx : int := -1
var speedy : int := 1
var font : int
var font2 : int
var movement1 : int := 0
var movement2 : int := 0
var keys : array char of boolean
var x := 175
var y := 0
colorback (black)
for i : 1 .. 25 %Counted loop makes the background stay black
    for j : 1 .. 80
        put " " ..
    end for
end for
setscreen ("nocursor,offscreenonly")
font := Font.New ("Arial Black:18")
font2 := Font.New ("Arial Black:12")
Font.Draw ("Pong", 280, 320, font, red)
put whatdotcolor (x, y)
procedure startGame
    cls
    Font.Draw ("Player 1 Score", 20, 340, font2, red)
    Draw.FillBox (0, 600, maxx, 360, brightred)
    Draw.FillBox (0, 00, maxx, 45, brightred)
    Draw.FillBox (0, 175 + movement1, 10, 225 + movement1, brightred)
    Draw.FillBox (630, x + movement2, maxx, 225 + movement2, brightred)
    Input.KeyDown (keys)
    if keys ('w') then
        Draw.FillBox (0, 175 + movement1, 10, 225 + movement1, brightred)
        if movement1 = 45 - 175 then
            movement1 := movement1 - 2
        end if
    end if

    if keys (KEY_UP_ARROW) then
        Draw.FillBox (630, 175 + movement2, maxx, 225 + movement2, brightred)
        if movement2 = 45 - 175 then
            movement2 := movement2 - 2
        end if
    end if

    Draw.FillOval (x2, y2, radius, radius, brightblue)
    x2 := x2 + speedx
    y2 := y2 + speedy
    if y2 + speedy + radius > 360 or y2 + speedy - radius < 45 then
        speedy := speedy * -1
    end if
    if x2 + speedx + radius < 10 or x2 + speedx - radius > 630 then
        speedx := speedx * -1
    end if

end startGame



var startButton : int := GUI.CreateButton (maxx div 2 - 30, 60, 60, "Start Game", startGame)
procedure helpGame
    cls
    Font.Draw ("Refer to the instruction manual", 100, 320, font, red)
end helpGame
var helpButtom : int := GUI.CreateButton (maxx div 2 - 200, 60, 60, "Help", helpGame)

loop
    startGame
    View.Update
    exit when GUI.ProcessEvent
end loop

[syntax="turing"]

-----------------------------------
neuro.akn
Wed Jan 16, 2013 12:51 pm

RE:Text appear over box
-----------------------------------
Try changing the colour of your text to black or something dark to be seen on the red, and changing the coordinates of the text to somewhere over the drawfillbox

-----------------------------------
Salman
Wed Jan 16, 2013 6:28 pm

RE:Text appear over box
-----------------------------------
I tried doing that but it still doesnt work.

-----------------------------------
Pyralblitzzz
Thu Jan 17, 2013 11:53 am

RE:Text appear over box
-----------------------------------
Just to be clear, you're trying to get the "Player 1 Score" text to appear over the red box at the top? Because if that's the case, then take a look at the order you're drawing the objects in. The text is being drawn first, then the box. The box covers the txt, and it never shows up. How can you fix that?

-----------------------------------
Salman
Thu Jan 17, 2013 1:18 pm

RE:Text appear over box
-----------------------------------
Thanks, i got it, i put the font after the box
