Help with on-screen writing
Author |
Message |
Metaxu
|
Posted: Thu Jan 03, 2013 2:44 pm Post subject: Help with on-screen writing |
|
|
What is it you are trying to achieve?
I'm trying to get the program to write over the score for the left side player.
What is the problem you are having?
The new score will not write over the 0 that is there
Describe what you have tried to solve this problem
locatexy to the location of the previous score
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: |
%Turing Pong remake
%ICS 201 Final Project 2012 - 2013
%Thomas Jack
var name, nameconfirm : string
var menufont, titlefont, scorefont, mousex, mousey, mouseclick, x, y, z, w, y1, y2, speed, p1point, p2point : int
y1 := maxy div 2
y2 := maxy div 2
w := 3
z := 3
x := maxx div 2
y := maxy div 2
speed := 50
titlefont := Font.New ("rod:72")
menufont := Font.New ("serif:20")
proc leftsidepoint
colourback (black)
colour (white)
p1point := 0
p1point := p1point + 1
locatexy (200, 370)
put p1point
end leftsidepoint
proc multiplayer
var chars : array char of boolean
loop
Input.KeyDown (chars )
x := x + w
y := y + z
if chars ('w') then
if y1 + 50 >= maxy then
else
y1 := y1 + 5
end if
end if
if chars ('s') then
if y1 - 50 <= 0 then
else
y1 := y1 - 5
end if
end if
if chars (KEY_UP_ARROW) then
if y2 + 50 >= maxy then
else
y2 := y2 + 5
end if
end if
if chars (KEY_DOWN_ARROW) then
if y2 - 50 <= 0 then
else
y2 := y2 - 5
end if
end if
if x + 6 >= maxx - 2 then
leftsidepoint
end if
if x - 4 <= 0 then
% ADD POINT HERE
end if
if y >= maxy - 2 then
z := - 3
end if
if x >= 10 and x <= 20 and y >= y1 - 50 and y <= y1 + 50 then
w := 3
end if
if x >= 620 and x <= 630 and y >= y2 - 50 and y <= y2 + 50 then
w := - 3
end if
if y <= 2 then
z := 3
end if
locatexy (200, 370)
put "0"
locatexy (435, 370)
put "0"
drawfillbox (10, y1 - 50, 20, y1 + 50, white)
drawfillbox (620, y2 - 50, 630, y2 + 50, white)
drawfilloval (x, y, 6, 6, white)
View.Update
delay (speed )
cls
View.Set ("offscreenonly")
end loop
end multiplayer
proc singleplayer
end singleplayer
drawfillbox (0, 0, maxx, maxy, black)
colourback (black)
colour (white)
put "Hello and welcome to 'Plong', a Pong remake by Thomas Jack.\n"
put "Please enter your name to continue: " ..
get name
put ""
put "So your name is ", name, " ? (Y / N): " ..
loop
get nameconfirm
nameconfirm := Str.Lower (nameconfirm )
exit when nameconfirm = "y" or nameconfirm = "n"
put "Please enter 'Y' or 'N': " ..
end loop
View.Update
if nameconfirm = "y" then
else
put "Please enter the name you wish to be called: " ..
get name
put name
end if
cls
drawfillbox (0, 0, maxx, maxy, black)
Font.Draw ("Plong", 205, 320, titlefont, white)
Font.Draw ("Single Player", 240, 210, menufont, white)
Font.Draw ("Multiplayer", 245, 160, menufont, white)
View.Set ("offscreenonly")
loop
drawfillbox (0, 0, maxx, maxy, black)
locatexy (0, maxy)
put "User: ", name
Font.Draw ("Plong", 200, 320, titlefont, white)
Font.Draw ("Single Player", 240, 210, menufont, white)
Font.Draw ("Multiplayer", 245, 160, menufont, white)
Mouse.Where (mousex, mousey, mouseclick )
if mousex >= 240 and mousex <= 390 and mousey >= 210 and mousey <= 230 then
drawline (235, 200, 391, 200, white)
drawline (235, 200, 235, 235, white)
end if
if mousex >= 245 and mousex <= 375 and mousey >= 160 and mousey <= 180 then
drawline (240, 150, 380, 150, white)
drawline (240, 150, 240, 180, white)
end if
if mousex >= 245 and mousex <= 390 and mousey >= 210 and mousey <= 230 and mouseclick = 1 then
singleplayer
end if
if mousex >= 245 and mousex <= 375 and mousey >= 160 and mousey <= 180 and mouseclick = 1 then
multiplayer
end if
View.Update
end loop
|
Please specify what version of Turing you are using
<Answer Here> |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dreadnought
|
Posted: Thu Jan 03, 2013 3:21 pm Post subject: Re: Help with on-screen writing |
|
|
You appear to be doing this quite a bit in your multiplayer game loop. |
|
|
|
|
|
|
|