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

Username:   Password: 
 RegisterRegister   
 ?????
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Murthtwo




PostPosted: Fri Dec 14, 2007 8:25 am   Post subject: ?????

Can somebody tell me how to fix my problem; When I shoot my ball, my target and line disappear:


setscreen ("graphics:max;max")

var font1, font2, font3 : int
var ovalx, ovaly : int
var start : int
var load : string := "Loading"
var displacement : int
var force : int
var launchx, launchy : int
var buttonnumber, buttonupdown : int
var zz : int := 1
var rad, rad2 : int
rad := 10
rad2 := 25

launchx := maxx div 2
launchy := maxy div 2




ovalx := Rand.Int (1, 619)
ovaly := Rand.Int (150, 399)


font1 := Font.New ("Stenvil:40")
Font.Draw ("Welcome to Johnathon's Target Game",100,600, font1, 1)
Font.Free (font1)



font1 := Font.New ("Stencil:40")
Font.Draw ("1. Objective/Controls", 530, 394, font1, 1)
Font.Free (font1)


font2 := Font.New ("Stencil:40")
Font.Draw ("2. Comence Game", 530, 324, font2, 1)
Font.Free (font2)





get start

if start = 1 then
cls

font3 := Font.New ("Stencil:40")
Font.Draw ("Objective/Controls", 613, 624, font3, 53)
Font.Free (font3)
drawbox (461, 407, 1032, 499, black)

color (53)
locate (20, 60)
put " Click somewhere under the line to launch the ball from the cannon " ..
locate (21, 60)
put " The objective is to hit the target with the ball" ..
locate (22, 60)
put " Each time you hit the target, you recieve 10 points" ..
locate (23, 60)
put " If you miss the target, you loose 20 points" ..
Input.Pause
cls
end if

if start = 2 then
cls
end if


proc target

drawfilloval (ovalx, ovaly, rad2, rad2, brightred)
drawfilloval (ovalx, ovaly, 15, 15, white)
drawfilloval (ovalx, ovaly, 8, 8, brightred)

end target


proc ball
for i : 1 .. 1000 by 2
displacement := round (1 / 250 * (- (i - 40 * force) ** 2 + (40 * force) ** 2))
drawfilloval (launchx + i, launchy + displacement, rad, rad, blue)

View.Update
cls

end for
end ball






color (53)
locate (20, 60)
put " How hard do you want to shoot your ball?"
delay (100)
locate (21, 75)
put " 1-2-3-4-5-6-7-8 "
locate (25, 70)
put "Force = " ..

get force
if force = 1 then
force := 1
elsif force = 2 then
force := 2
elsif force = 3 then
force := 3
elsif force = 4 then
force := 4
elsif force = 5 then
force := 5
elsif force = 6 then
force := 6
elsif force = 7 then
force := 7
elsif force = 8 then
force := 8
end if
colorback (grey)
cls

Draw.ThickLine (1, 150, 2000, 150, 5, black)
target
loop

setscreen ("offscreenonly")
Draw.ThickLine (1, 150, 2000, 150, 5, black)


target

View.Update
buttonwait ("down", launchx, launchy, buttonnumber, buttonupdown)

if launchx > 1 and launchx < 2000 and launchy < 150 and launchy > 10 then

ball
Draw.ThickLine (1, 150, 2000, 150, 5, black)


target
else

locate (20, 60)
put " ->Please try again<- "
locate (21, 60)
put " ->Invalid Position<-"



end if
View.Update
cls

end loop
Sponsor
Sponsor
Sponsor
sponsor
Jestar




PostPosted: Fri Dec 14, 2007 10:30 am   Post subject: Re: ?????

you just had a cls in the wrong place. silly mistake :p


code:
setscreen ("graphics:max;max")

var font1, font2, font3 : int
var ovalx, ovaly : int
var start : int
var load : string := "Loading"
var displacement : int
var force : int
var launchx, launchy : int
var buttonnumber, buttonupdown : int
var zz : int := 1
var rad, rad2 : int
rad := 10
rad2 := 25

launchx := maxx div 2
launchy := maxy div 2




ovalx := Rand.Int (1, 619)
ovaly := Rand.Int (150, 399)


font1 := Font.New ("Stenvil:40")
Font.Draw ("Welcome to Johnathon's Target Game", 100, 600, font1, 1)
Font.Free (font1)



font1 := Font.New ("Stencil:40")
Font.Draw ("1. Objective/Controls", 530, 394, font1, 1)
Font.Free (font1)


font2 := Font.New ("Stencil:40")
Font.Draw ("2. Comence Game", 530, 324, font2, 1)
Font.Free (font2)





get start

if start = 1 then
    cls

    font3 := Font.New ("Stencil:40")
    Font.Draw ("Objective/Controls", 613, 624, font3, 53)
    Font.Free (font3)
    drawbox (461, 407, 1032, 499, black)

    color (53)
    locate (20, 60)
    put " Click somewhere under the line to launch the ball from the cannon " ..
    locate (21, 60)
    put " The objective is to hit the target with the ball" ..
    locate (22, 60)
    put " Each time you hit the target, you recieve 10 points" ..
    locate (23, 60)
    put " If you miss the target, you loose 20 points" ..
    Input.Pause
    cls
end if

if start = 2 then
    cls
end if


proc target

    drawfilloval (ovalx, ovaly, rad2, rad2, brightred)
    drawfilloval (ovalx, ovaly, 15, 15, white)
    drawfilloval (ovalx, ovaly, 8, 8, brightred)

end target


proc ball
    for i : 1 .. 1000 by 2

        displacement := round (1 / 250 * (- (i - 40 * force) ** 2 + (40 * force) ** 2))

        drawfilloval (launchx + i, launchy + displacement, rad, rad, blue)
        View.Update
    end for
end ball






color (53)
locate (20, 60)
put " How hard do you want to shoot your ball?"
delay (100)
locate (21, 75)
put " 1-2-3-4-5-6-7-8 "
locate (25, 70)
put "Force = " ..

get force
if force = 1 then
    force := 1
elsif force = 2 then
    force := 2
elsif force = 3 then
    force := 3
elsif force = 4 then
    force := 4
elsif force = 5 then
    force := 5
elsif force = 6 then
    force := 6
elsif force = 7 then
    force := 7
elsif force = 8 then
    force := 8
end if
colorback (grey)
cls

Draw.ThickLine (1, 150, 2000, 150, 5, black)
target
loop

    setscreen ("offscreenonly")
    Draw.ThickLine (1, 150, 2000, 150, 5, black)


    target

    View.Update
    buttonwait ("down", launchx, launchy, buttonnumber, buttonupdown)

    if launchx > 1 and launchx < 2000 and launchy < 150 and launchy > 10 then

        ball
        Draw.ThickLine (1, 150, 2000, 150, 5, black)


        target
    else

        locate (20, 60)
        put " ->Please try again<- "
        locate (21, 60)
        put " ->Invalid Position<-"



    end if
    View.Update


end loop
SNIPERDUDE




PostPosted: Fri Dec 14, 2007 11:59 am   Post subject: Re: ?????

Next time, please do not post a thread title that is not specific to the question ("?????").
Number two, you posted this thread under the wrong forum. This is supposed to be under turing help, not turing submissions.
StealthArcher




PostPosted: Fri Dec 14, 2007 12:18 pm   Post subject: Re:?????

Number three, we've already proven this is ripped off. Write your own code next time.
Clayton




PostPosted: Fri Dec 14, 2007 12:42 pm   Post subject: Re:?????

Number four, way too much flaming and spam.

This thread is locked
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: