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

Username:   Password: 
 RegisterRegister   
 text over the graphics
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
doey55




PostPosted: Thu Apr 29, 2004 4:49 pm   Post subject: text over the graphics

Hi in my comouter class I had to my star falling in the background sort of like the [source] snow program but in my program the falling stars can only come on when someone gets a correct answer on my quiz. But when i try to do it you cant see my quiz. If i need to post it ask

thanx[/u]
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Thu Apr 29, 2004 4:54 pm   Post subject: (No subject)

A moving background is run when someone gets a correct answer? And the quiz continues? I suggest u just play an animation of the stars, and have a text saying "You got it right" or something, that is ran for a bit after someone gets an answer right. And use Font.Draw for ur text when u do that.
doey55




PostPosted: Thu Apr 29, 2004 5:16 pm   Post subject: (No subject)

here help
code:

View.Set ("offscreenonly")
colorback (black)
cls

type SnowType :
    record
        X, Y, Spd, Size : int
    end record

var Snow : array 1 .. 100 of SnowType

for rep : 1 .. 100
    Snow (rep).X := Rand.Int (5, 645)
    Snow (rep).Y := Rand.Int (5, 475)
    Snow (rep).Spd := Rand.Int (1, 6)
    Snow (rep).Size := Snow (rep).Spd
end for
var iCount : int := 0
loop
    delay (10)
    for rep : 1 .. 100
        Snow (rep).Y -= Snow (rep).Spd
        if Snow (rep).Y < Snow (rep).Size then
            Snow (rep).Y := Rand.Int (475, 575)
        end if
        if iCount = 4 then
            Snow (rep).X += Rand.Int (-1, 1)
        end if
        drawfillstar (Snow (rep).X, Snow (rep).Y, Snow (rep).X + Snow (rep).Size, Snow (rep).Y + Snow (rep).Size, yellow)
    end for
    if iCount = 4 then
        iCount := 0
    else
        iCount += 1
    end if
    View.Update
    cls
end loop

setscreen ("graphics:max;max,nobuttonbar")

colorback (red)
put "Welcome to my quiz" ..
cls       
var name : string
var guess : int
var right: int
right:= 0
procedure correct
put "You have ", right, "out of 3"
end correct

put "Welcome to my quiz!!!!!!"
delay (2000)
put "I have programmed a guide to help you through the quiz, his name is Sam"
delay (1500)
put "Sam: This quiz will affect your final mark!"
delay (2000)
put "Enter your name"
get name

put "Sam will now find more information about you"
delay (6000)
% The "ShowUserName" program.
var userName := Sys.GetUserName
if Error.Last not= 0 then
    put "Sys.GetUserName failed: ", Error.LastMsg
else
    put "User Name: ", userName
end if

var computerName := Sys.GetComputerName
if Error.Last not= 0 then
    put "Sys.GetComputerName failed: ", Error.LastMsg
else
    put "Computer Name: ", computerName
end if


put "Sam: Now for your first question"
delay (1500)
put "25+30"
delay (1200)

put "Sam: Enter your guess, Now"
get guess
if guess = 55 then
    put "Your correct"
else
    put "haha you can't add"
end if
delay (2000)
cls

put "Sam: Second question "
delay (1500)
put "22 div 2"
put "Sam: Enter your guess, Now"
get guess
if guess = 11 then
    put "Your correct"
else
    put "WRONG! "
end if
delay(2000)
cls


put "Sam: Third Question"
delay (1500)
put "12*12"
put "Sam: Enter your guess, Now"
get guess
if guess = 144 then
    put "Your correct"
else
    put "WRONG!"
end if
delay(2000)
cls
correct
recneps




PostPosted: Thu Apr 29, 2004 5:48 pm   Post subject: (No subject)

its really complicated... you have to draw the text in the same loop as the snowflakes, and after the snowflakes in that loop so its on top... understand?
doey55




PostPosted: Thu Apr 29, 2004 5:57 pm   Post subject: (No subject)

nope
shorthair




PostPosted: Thu Apr 29, 2004 6:12 pm   Post subject: (No subject)

HEy doey , i hate to be on your case but if you have alot of code , plese snip it so we can see the problem area , if you dont know thene please post it as a file , just so we can keep thins neat , if there is a small amount of code , then its just fine , but anything over the size of that should be uploaded as a file

Have A Good One Very Happy Very Happy

Oh and to try help you out , Turing has functions to draw objects behind other objects , im not sure if it works for text though , im gonna try write you a little sample program , il pm it to you by friday night , if you still neeed help , also if you ned quick help add one of the active members to your ms n, for the most part we dont mind helping ,

We dont bite ( hard ) Twisted Evil
doey55




PostPosted: Thu Apr 29, 2004 6:15 pm   Post subject: (No subject)

thanx hahahaha funny
but its has to be done by tommorow is there anyway u can do it now?
thanx
Tony




PostPosted: Thu Apr 29, 2004 7:22 pm   Post subject: (No subject)

yes, it works for text
code:

Draw.FillStar(0,0,100,100,red)
var picID:= Pic.New(0,0,100,100)
cls
for i:1..maxrow
put "tony was here"
end for
Pic.Draw(picID,0,0,picUnderMerge)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
doey55




PostPosted: Fri Apr 30, 2004 4:33 am   Post subject: (No subject)

k I tired this and it doesnt work
code:

View.Set ("offscreenonly")
colorback (black)
cls

type Startype :
    record
        X, Y, Spd, Size : int
    end record

var Star : array 1 .. 100 of Startype

for rep : 1 .. 100
setscreen ("graphics:max;max,nobuttonbar")

colorback (black)
put "Welcome to my quiz" ..
cls     
colour(14) 
var name : string
var guess : int
var right: int
right:= 0

put "Welcome to my quiz!!!!!!"
delay (2000)
put "I have programmed a guide to help you through the quiz, his name is Sam"
delay (1500)
put "Sam: This quiz will affect your final mark!"
delay (2000)
put "Enter your name"
get name

put "Sam will now find more information about you"
delay (6000)
% The "ShowUserName" program.
var userName := Sys.GetUserName
if Error.Last not= 0 then
    put "Sys.GetUserName failed: ", Error.LastMsg
else
    put "User Name: ", userName
end if

var computerName := Sys.GetComputerName
if Error.Last not= 0 then
    put "Sys.GetComputerName failed: ", Error.LastMsg
else
    put "Computer Name: ", computerName
end if


put "Sam: Now for your first question"
delay (1500)
put "25+30"
delay (1200)

put "Sam: Enter your guess, Now"
get guess
if guess = 55 then
    put "Your correct"
else
    put "haha you can't add"
end if
delay (2000)
cls

put "Sam: Second question "
delay (1500)
put "22 div 2"
put "Sam: Enter your guess, Now"
get guess
if guess = 11 then
    put "Your correct"
else
    put "WRONG! "
end if
delay(2000)
cls


put "Sam: Third Question"
delay (1500)
put "12*12"
put "Sam: Enter your guess, Now"
get guess
if guess = 144 then
    put "Your correct"
else
    put "WRONG!"
end if
delay(2000)
cls

    Star (rep).X := Rand.Int (5, 645)
    Star (rep).Y := Rand.Int (5, 475)
    Star (rep).Spd := Rand.Int (1, 6)
    Star (rep).Size := Star (rep).Spd
end for
var iCount : int := 0
loop
    delay (10)
    for rep : 1 .. 100
        Star (rep).Y -= Star (rep).Spd
        if Star (rep).Y < Star (rep).Size then
            Star (rep).Y := Rand.Int (475, 575)
        end if
        if iCount = 4 then
            Star (rep).X += Rand.Int (-1, 1)
        end if
        drawfillstar (Star (rep).X, Star (rep).Y, Star (rep).X + Star (rep).Size, Star (rep).Y + Star (rep).Size, yellow)
    end for
    if iCount = 4 then
        iCount := 0
    else
        iCount += 1
    end if
    View.Update
    cls
end loop
Tony




PostPosted: Fri Apr 30, 2004 6:05 am   Post subject: (No subject)

Confused how about you read the tips that are given to you... such as one above
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
AsianSensation




PostPosted: Fri Apr 30, 2004 5:11 pm   Post subject: (No subject)

Rolling Eyes this is what happens when you take other people's code without understanding first.

When you are drawing the stars, I suggest, instead of using the drawfillstar command, either import a picture, or at the very beginning your program, save 3 stars as 3 separate pics, then use draw those pics instead of drawfillstar. Use picUnderMerge like tony had showed you, and you will be able to achieve what you wanted.
doey55




PostPosted: Fri Apr 30, 2004 5:21 pm   Post subject: (No subject)

i tried what tony said but i still cant get it, how would i do it correctly?

sry guys
thanx
AsianSensation




PostPosted: Fri Apr 30, 2004 5:28 pm   Post subject: (No subject)

instead of:
code:
drawfillstar (Star (rep).X, Star (rep).Y, Star (rep).X + Star (rep).Size, Star (rep).Y + Star (rep).Size, yellow)


do this:

code:
if Star (rep).Size = 1 then
   Pic.Draw (StarSize1, Star (rep).X, Star (rep).Y, picUnderMerge)
end if


assuming you have already have taken the pictures for the stars beforehand.
doey55




PostPosted: Fri Apr 30, 2004 6:35 pm   Post subject: (No subject)

once again I failed lol
i tried again and agian and i cant do my quiz with the stars falling in the background when the user gets an answer right and i tried the other thign u just showed but i couldnt get the thing going for what u said about assuming it didnt work
can someone help me
AsianSensation




PostPosted: Sat May 01, 2004 3:53 pm   Post subject: (No subject)

show me what you have done trying to fix it first, and I'll see what I can do.
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 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: