Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Trying to find out how to display a number and increase the displayed number on screen
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
azamz




PostPosted: Wed Jan 17, 2018 8:28 pm   Post subject: Trying to find out how to display a number and increase the displayed number on screen

Hi, I'm new to Turing, and I'm trying to make a "scoreboard" program that displays the team name in a button and the score beside it. I want it so that when you click the button, the score increases and it shows on screen. Right now, I'm having trouble displaying the 'score1' variable. Anyway I could do this and what I said before? Thank you in advance.

Code:

%ScoreBoard by Zayed Azam

import GUI

setscreen("graphics:1366,768")

var flask_L : int := Pic.FileNew("flask1.jpg")
var flask_R : int := Pic.FileNew("flask.jpg")
var title_font := Font.New("ComicSansMS:40")
var score_font := Font.New("Palatino:24")

Font.Draw ("Chem Rush",(maxx div 2)-100, 700,title_font,black)

Pic.Draw(flask_L,maxx div 100,maxy div 2, picCopy)
Pic.Draw(flask_R,((maxx div 4)*3)+80,maxy div 2, picCopy)

var score1: int :=0

procedure team1_point
score1 := +1
end team1_point
var team1 : int := GUI.CreateButtonFull(maxx div 4,600,100,"Team 1",team1_point,0,'^D', true)
GUI.SetColour(team1,brightred)
Font.Draw (intstr(score1),1400,600,score_font,black)
var team1_score : int := GUI.CreateLabelFull(0,0,intstr(score1),maxx div 2,maxy div 2,GUI.MIDDLE + GUI.CENTER, 0)

var quit_button : int := GUI.CreateButton(1300,745,0,"QUIT",GUI.Quit)

loop
exit when GUI.ProcessEvent
end loop
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Wed Jan 17, 2018 10:17 pm   Post subject: RE:Trying to find out how to display a number and increase the displayed number on screen

Changing the score variable won't automatically change the displayed score. You need to erase the old score, then redraw the new score on top of it.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: