Post by Nicky Peter Hollyoake on Apr 13, 2011 21:42:17 GMT -5
Ok, I don't know how many of you have played this sort of game for it, thiers mutiple vesions of it, as I'm creating a version myself anyway.
Issues:
* Point system ain't very good
* Easy, I'll be increasing with more points you get
* Hopefully you an collect items to increase/descrease your ball/screen speed, and collect more points.
Any other things you think I should work on, pleas say.
Oh, and I'm crap at psychics, so do't judge me on it, I will try and make the movement more smoother.
- Nicky
Issues:
* Point system ain't very good
* Easy, I'll be increasing with more points you get
* Hopefully you an collect items to increase/descrease your ball/screen speed, and collect more points.
Any other things you think I should work on, pleas say.
'2D Ball psychics - BallDown
'Screen setup
ResizeText(50, 30)
TextMode(TEXT_OVERLAID)
glMatrixMode(GL_PROJECTION)
glLoadidentity()
glOrTho(0, TextCols(), TextRows(), 0, 0, 1)
glMatrixMode(GL_MODELVIEW)
glLineWidth(2)
''''''''''''''''''''''''''''''''''''''''''''''''''''
const ScreenSpeed# = 0.01
const BallSpeed# = 0.0015
const BallSize# = 0.5
const Gravity# = 0.025
const BallBounce# = 0
const MaxHolesPerLine = 2
const SpaceBetweenPF = 3 'Space between each platform
const DeathBeam = 5
const MP = 8 'Max platforms
const PFW# = 0.4 'Platform width
dim TC=TextCols()-1, TR=8
struc sBall
lpos#(1)
pos#(1)
vec#(1)
endstruc
struc sPlatForm
Col(50)
F
Y#
endstruc
dim sBall Ball
dim sPlatForm PF(TR)
dim Mouse#
dim Points
dim x, y
dim r, i
dim t 'time
'Player default position
Ball.Pos#(1) = (TextRows() / 2.0) - 4
for y = 0 to TR
for i = 0 to MaxHolesPerLine-1
r = rnd() % TC
if PF(y).Col(r) then
i=i-1
else
PF(y).Col(r ) = true
PF(y).Col(r+1) = true
endif
next
PF(y).Y# = (TextRows() / 2.0) + (y * SpaceBetweenPF)
next
while true
'OpenGL
glClear(GL_COLOR_BUFFER_BIT)
'User-input
Mouse# = (Mouse_X() * TC) - Ball.Pos#(0)
Ball.Vec#(0) = Ball.Vec#(0) + (SGN(Mouse#) * BallSpeed#)
if Ball.Vec#(0) <= -0.15 then
Ball.Vec#(0) = -0.15
elseif Ball.Vec#(0) >= 0.15 then
Ball.Vec#(0) = 0.15
endif
'Increase/decrease position
Ball.LPos# = Ball.Pos#
Ball.Pos#(0) = Ball.Pos#(0) + Ball.Vec#(0)
'Players gravity
Ball.Pos#(1) = Ball.Pos#(1) + Gravity#
'Lets make sure it don't go off screen the ball!
if Ball.Pos#(0) < 0 then Ball.Pos#(0) = 0 endif
if Ball.Pos#(0) > TC then Ball.Pos#(0) = TC endif
'Text
cls
Locate 0, 0: Print"POINTS:" ; Points
DrawText()
'Platforms
glBegin(GL_QUADS)
glColor3f(0, 1, 0)
for y = 0 to TR
for x = 0 to TC
if not PF(y).Col(x) then
glVertex2f(x , PF(y).Y#)
glVertex2f(x , PF(y).Y# + PFW#)
glVertex2f(x+1, PF(y).Y# + PFW#)
glVertex2f(x+1, PF(y).Y#)
endif
'Gravity & Collision check
if not PF(y).F and (Ball.Pos#(1)+1) >= PF(y).Y# and (Ball.Pos#(1)+1) <= PF(y).Y# + PFW# then
if (PF(y).Col(x) and Ball.Pos#(0)+1 >= x and Ball.Pos#(0)+1 <= x+1) then
PF(y).F = true
else
Ball.Pos#(1) = PF(y).Y# - 1
endif
endif
next
next
glEnd()
'death beam
glBegin(GL_LINES)
glColor3f(1, 1, 1)
glVertex2f(TC+1, DeathBeam)
glVertex2f(0 , DeathBeam)
glEnd()
'Ball
glBegin(GL_TRIANGLE_FAN)
glColor3f(1, 1, 1)
glVertex2f(Ball.Pos#(0) + 0.5, Ball.Pos#(1) + 0.5)
glColor3f(1, 0, 0)
for i = 0 to 360
glVertex2f(Ball.Pos#(0) + (0.5+cosd(i)*0.5), Ball.Pos#(1) + (0.5+sind(i)*0.5))
next
glEnd()
'Death..?
if Ball.Pos#(1) <= DeathBeam then
Swapbuffers()
END
endif
Swapbuffers()
'Screen animation & Renew platforms
for i = 0 to TR
PF(i).Y# = PF(i).Y# - Gravity#/2.0
if PF(i).Y# < DeathBeam then
Points=Points+5
'switch
for y = 1 to TR
PF(y-1) = PF(y)
next
'clear gaps
for x = 0 to TC
PF(TR).Col(x) = false
next
'Make new platform
for y = 0 to MaxHolesPerLine-1
r = rnd() % TC
if PF(TR).Col(r) then
y=y-1
else
PF(TR).Col(r ) = true
PF(TR).Col(r+1) = true
PF(TR).Y# = PF(TR-1).Y# + SpaceBetweenPF
PF(TR).F = false
endif
next
endif
next
wend
Oh, and I'm crap at psychics, so do't judge me on it, I will try and make the movement more smoother.
- Nicky