So what exactly are you saying...how do I go about defining Quit$ before it is declared and how do I set text size and color without setting the text size for the entire do loop. And if I do
Do
Set text size 30
Print "Testing"
Set text size 20
Loop
The game slows down to a point where it is nearly unplayable.
Heres my current pong code atm.
SET DISPLAY MODE 1024,768,32
SET WINDOW TITLE "3D PONG By: OneShot"
SET WINDOW SIZE 800,615
SET WINDOW POSITION 110,70
hide mouse
`Player1 Paddle
make object box 1,1,1,3:color object 1,rgb(255,0,0)
`Player2 Paddle
make object box 2,1,1,3:color object 2,rgb(0,255,0)
`The Ball
make object sphere 3,1:color object 3,rgb(50,50,50)
`The Floor
make object box 4,10,0.1,10:color object 4,rgb(100,255,179)
`Position of Ball
balla#=-90
ballx#=0
balls#=0.005
`Button Properties
x1=20
y1=55
x2=Text Width(Start$)
y2=Text Height(Start$)
x3=400
y3=210
x4=Text Width(Quit$)
y4=Text Height(Quit$)
`Adding content to strings
SET TEXT FONT "Arial"
SET TEXT SIZE 30
INK RGB(255,255,255),0
p1wins$="Player 1 wins the point!"
p2wins$="Player 2 wins the point!"
Start$="Play 3D Pong"
Quit$="Quit"
p1winsgame$="Player 1 WINS THE GAME!"
p2winsgame$="Player 2 WINS THE GAME!"
Game:
hide mouse
`Start of MAIN Do:Loop**************************
sync on:do
position camera 0,10,-10
point camera 0,0,0
Set cursor 325,150:PRINT p3score#
Set cursor 905,150:PRINT p2score#
TEXT 350,50,"3D PONG By: Zachary Laney"
SET TEXT SIZE 30
Text 100,150,"Player One's Score:"
Text 680,150,"Player Two's Score:"
Set Cursor 430,80:Print "Games Won"
Set cursor 482,105:Print p2winscore#
Set cursor 500,105:Print "-"
Set Cursor 512,105:Print p1winscore#
`Speed of Ball
ballx#=newxvalue(ballx#,balla#,balls#)
ballz#=newzvalue(ballz#,balla#,balls#)
`Player 1 Controls *RED*
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IF upkey()=1 AND player1pos# < 3.5 then player1pos#=player1pos#+0.01
IF downkey()=1 AND player1pos# > -3.5 then player1pos#=player1pos#-0.01
`Player 2 Controls *GREEN*
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IF keystate(17)=1 AND player2pos# < 3.5 then player2pos#=player2pos#+0.01
IF keystate(31)=1 AND player2pos# > -3.5 then player2pos#=player2pos#-0.01
`Ball Movement
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ballx#<-4 and ballx# > -4.5 and ABS(player1pos#-ballz#) < 1.6 then balla#=360-balla#
if ballx#>4 and ballx# < 4.5 and ABS(player2pos#-ballz#) < 1.6 then balla#=360-balla#
`Ball Spin
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ball#<-4 and ballx# > -4.5 then XROTATE OBJECT 3,OBJECT ANGLE X(1)+200
if ball#>4 and ballx < 4.5 then XROTATE OBJECT 3,OBJECT ANGLE X(1)-200
`Adding Specific Ball Speed when it hits the paddle
if ballx#<-4 and ballx# > -4.5 and ABS(player1pos#-ballz#) < 1.75 then balls#=balls#+0.0002
if ballx#>4 and ballx# < 4.5 and ABS(player2pos#-ballz#) < 1.75 then balls#=balls#+0.0002
`Scoring boundaries
if ballx#<-5 then text 600,200,p2wins$
if ballx#>6 then text 200,200,p1wins$
if ballx#<-8 then p2score#=p2score#+1:ballx#=0:ballz#=0:balla#=280:balls#=0.005:Wait 500
if ballx#>8 then p3score#=p3score#+1:ballx#=0:ballz#=0:balla#=95:balls#=0.005:wait 500
if p2score#=10 then text 350,100,p2winsgame$:wait 1000:p2score#=0:p3score#=0:p1winscore#=p1winscore#+1
if p3score#=10 then text 350,100,p1winsgame$:wait 1000:p2score#=0:p3score#=0:p2winscore#=p2winscore#+1
if p3score#>p2score# then color object 3,rgb(255,0,0):ink rgb(255,0,0),0
if p2score#>p3score# then color object 3,rgb(0,255,0):ink rgb(0,255,0),0
if p3score#=p2score# then color object 3,rgb(0,0,0):ink rgb(255,255,255),0
`Setting barrier for the top and bottom sides of the playing square
if ballz#<-4.5 or ballz#>4.5 then balla#=180-balla#
`Adding specific Ball Movement for Player 1
if upkey()=1 and ballx#<-4 and ballx#>-4.5 then balla#=balla#-RND(-8)-1
if downkey()=1 and ballx#<-4 and ballx#>-4.5 then balla#=balla#+RND(8)+1
`Adding specific Ball Movement for Player 2
if keystate(17)=1 and ballx#>4 and ballx#<4.5 then balla#=balla#+RND(8)+1
if keystate(31)=1 and ballx#>4 and ballx#<4.5 then balla#=balla#-RND(-8)-1
`Specifying float balla# to a value between 1-360
balla#=wrapvalue(balla#)
`Position Object for Player 1 and 2 Boxes
position object 1,-5,0,player1pos#:position object 2,5,0,player2pos#
`Position Object for Ball
position object 3,ballx#,0,ballz#:yrotate object 3,balla#
`Position Object for Floor
position object 4,0,-0.55,0
`End of MAIN Do:Loop******************************
sync:loop
Another problem is...when the ball comes in from an Angle it goes right through my paddle. Omg so many problems.
But first things first I gotta get my menu working!!
Thx for the help guys I really appreciate it
Just started! Help!!!!