var wholescreen :array1.. sizepic(0, 0, maxx, maxy)ofint var arrowKeys :arraycharofboolean var colorchanger1 :int var PicID, PicID1 :int var replay :string var x1, y1, x2, y2 :int var ball_x1, ball_x2, ball_y1, ball_y2 :int var ball_directionx1 :int:=1 var ball_directiony1 :int:=1 var ball_directiony2 :int:=1 var ball_directionx2 :int:=1 var fontS :int var x, y :int var ball_speed, ball_speed1 :int var continueGame :string var lives :int var score :int var timeElapsed1, timeElapsed2 :int var block_x1, block_y1, block_x2, block_y2 :int var x1_1, y1_1, x2_2, y2_2:int var debugger :boolean:=false var ball_Radius :int:=15 var xb1, yb1, xb2, yb2 :int var alive :array1.. 16ofboolean var rc1, rc2, rc3, rc4 :int type BrickData : record
xCord, yCord, width, height :int
alive :boolean endrecord
var brick :array1.. 6of BrickData
xb1 :=50
yb1 :=maxydiv2
x :=50
y :=maxydiv2 + 50 randint(rc1, 2, 6) randint(rc2, 2, 6) randint(rc3, 2, 6) randint(rc4, 2, 6)
color(91) put"Lives: ", lives
locate(1, 20) put"Score: ", score
locate(1, 40)
timeElapsed2 :=Time.Elapseddiv1000 - timeElapsed1
put"Game Time: ", timeElapsed2
if ball_y1 < 35then cls
lives -=1
ball_x1 :=512
ball_y1 :=200
ball_x2 :=650
ball_y2 :=200
ball_directionx1 :=1
ball_directiony1 :=1
ball_directiony2 :=1
ball_directionx2 :=1 if lives = -1then cls Font.Draw("You Have Lost :(",50, 50, fontS, green) put"You have acquired a total score of: ", score
loop put"Would you like to play again?" get replay
if replay ="Yes"or replay ="yes"or replay ="y"then put"Your game will replay shortly..." put"Get READY!" Time.Delay(3000)
timeElapsed1 :=0
lives :=4
TheGame2
timeElapsed1 :=Time.Elapseddiv1000 elsif replay ="No"or replay ="no"or replay ="n"then put"Good bye, and thanks for playing!" Time.Delay(2500) cls break else put"Invalid answer" cls endif endloop endif endif delay(10) View.Update delay(1) cls endloop end TheGame2
procedure Instructions
colorback(16) color(48) cls locate(4, 1) put"The objective of the game is..." locate(7, 1) color(58) put"to destroy all of the blocks on your side of the screen (left)" locate(10, 1) color(73) put"Before the computer destroys all of his blocks on his side of the screen (right)" locate(13, 1) color(81) put"You will use the 'Left' and 'Right' Arrow keys to move left and right" locate(16, 1) color(67) put"If you press the 'ESC' key on your keyboard the game will exit." locate(19, 1) color(96) put"Good Luck and go smash some blocks. HINT : You only have 3 Lives!" var game_Button :int:=GUI.CreateButton(265, 275, 0, "Click To Play!", TheGame2) end Instructions
procedure returnBack
var go_back :char:=" " loop put"Please enter 'y' to go back" get go_back
if go_back ="y"then Pic.Draw(PicID, maxxdiv2 - (638div2),maxydiv2 - (690div2),picCopy) var game_Button :int:=GUI.CreateButton(265, 275, 0, "Click To Play!", TheGame2) var instructions :int:=GUI.CreateButton(265, 225, 0, "Instructions", Instructions) exit endif endloop end returnBack
PicID :=Pic.FileNew("ball02.jpg") Pic.Draw(PicID, maxxdiv2 - (638div2),maxydiv2 - (690div2),picCopy) var fontS1 :int:=Font.New("Verdana:12") Font.Draw("Please click 'instructions' to view the instructions then 'Click To Play'.",35, 500, fontS1, red) assert fontS1 > 0 Font.Free(fontS1) var instructions :int:=GUI.CreateButton(265, 225, 0, "Instructions", Instructions) loop loop exitwhenGUI.ProcessEvent endloop endloop
proc Debugger (debugger_ :boolean) if debugger_ =truethen var mx, my, mb :int Mouse.Where(mx, my, mb) if mb =1then loop cls Mouse.Where(mx, my, mb) put"X: ", mx, " Y:", my
exitwhen mb not= 1 View.Update Time.DelaySinceLast(25) endloop endif endif end Debugger
Please specify what version of Turing you are using
4.1.1a
run the program to see where it goes wrong and help me fix it
Sponsor Sponsor
Dreadnought
Posted: Tue Jan 17, 2012 8:48 pm Post subject: Re: paying for answer
Don't make posts with titles like this....
Velocity wrote:
cant seem to delete the brick it keeps coming back
i would die before naming all that i tried
Turing:
% Multiple in the middle of the game loop for i :1.. 6
brick (i).xCord :=50 + ((i - 1)*75)
brick (i).yCord :=maxydiv2
brick (i).width :=50
brick (i).height :=25
brick (i).alive :=true endfor
I assume you pasted code someone wrote for you (probably as an answer to another question). Try to understand why the code someone else has written works. If you can do that, you won't need to paste it into your code.
Please, don't pay me.
rdrake
Posted: Tue Jan 17, 2012 9:15 pm Post subject: RE:paying for answer
Please try to avoid not only double posting, but triple posting the exact same topic. You have until somebody else posts under you to edit your own post.
I've removed your other two topics and am tempted to lock or remove this one as well.
Velocity
Posted: Tue Jan 17, 2012 9:21 pm Post subject: RE:paying for answer
@dreadnought even with it how would i get the brick to just go away, even if i were to just make 2 for loops with rows and columns?
crossley7
Posted: Tue Jan 17, 2012 9:37 pm Post subject: RE:paying for answer
generally a 'show' boolean variable is used like in the code seen here. That should be enough to get you on the right track. Think about how to properly use that variable and why it even exists
Velocity
Posted: Wed Jan 18, 2012 9:13 pm Post subject: RE:paying for answer
ok it exists to store movement patterns inside and to determine if the object is there or not. but how would i use that in effect with my code, example please?
Velocity
Posted: Wed Jan 18, 2012 9:16 pm Post subject: RE:paying for answer
can someon just write a simple example code to show how to clear the objectt when a ball or another object hits it. just so i can see it feed off it and work further into it, because right now i have no clue of where to go with it. +10 bits if you can.
Aange10
Posted: Wed Jan 18, 2012 9:21 pm Post subject: Re: RE:paying for answer
Velocity @ 18/1/2012, 8:16 pm wrote:
can someon just write a simple example code to show how to clear the objectt when a ball or another object hits it. just so i can see it feed off it and work further into it, because right now i have no clue of where to go with it. +10 bits if you can.
Go look in the submissions. Or the help forum.
OR, you could look at your other forum that "helped so much!" and maybe tell us where you are confused. Instead of requesting us to code it for you (which is was in that thread!)
Posted: Thu Jan 19, 2012 10:54 am Post subject: RE:paying for answer
Turing:
setscreen("offscreenonly") var blockLive :boolean:=true var ballx, bally :int:=0 var ballvx, ballvy :int:=1 var ballsize :int:=5 var blockx, blocky :int:=200
Posted: Thu Jan 19, 2012 1:19 pm Post subject: Re: RE:paying for answer
Raknarg @ Thu Jan 19, 2012 10:54 am wrote:
Turing:
setscreen("offscreenonly") var blockLive :boolean:=true var ballx, bally :int:=0 var ballvx, ballvy :int:=1 var ballsize :int:=5 var blockx, blocky :int:=200
Posted: Thu Jan 19, 2012 2:35 pm Post subject: RE:paying for answer
Well, i didn't give him the answer yet, he has to figure outhow to use it
Velocity
Posted: Thu Jan 19, 2012 3:33 pm Post subject: RE:paying for answer
i understand that if the ball collides with the brick it will draw another brick of the background color over it, but how come when i run my program... wwoooooow obvs because ... omg i get it.
Raknarg
Posted: Thu Jan 19, 2012 6:36 pm Post subject: RE:paying for answer
Thanks for that incredibly informative post (Y)
Alex C.
Posted: Thu Jan 19, 2012 8:27 pm Post subject: RE:paying for answer
so... Raknarg did you got paid yet?
in bits or karma?
or better yet... $v$
Velocity
Posted: Thu Jan 19, 2012 8:28 pm Post subject: RE:paying for answer