Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / 20 line challenge

Author
Message
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 2nd Apr 2003 18:21
Hello

I would like to join the 20 line challenge, and I have made a simple pong game

This is the readeble code (this works fine):

cls
hide mouse
sync on
sync rate 60
do
repeat
cls rgb(100,100,100)
ink rgb(255,255,255),1
print "choose level between 1 and 10"
input level#
until level# => 1 and level# = 0.0
enemyspeed#=0.0-enemymove#
endif
if playery# 480.0-levelline# then playery#=480.0-levelline#
if enemyy# 380.0 then enemyy#=380.0
if bally# 465.0 then ballyspeed# = 0.0-ballyspeed#
playery#=playery#+playerspeed#:enemyy#=enemyy#+enemyspeed#
ballx#=ballx#+ballxspeed#
bally#=bally#+ballyspeed#
sprite player,playerx#,playery#,player
sprite enemy,enemyx#,enemyy#,enemy
sprite ball,ballx#,bally#,ball
if sprite collision(player,ball)
ballxspeed#=0.0+(abs(ballxspeed#)+ballinc#)
random#=(rnd(10)-5)/10.0
ballyspeed#=ballyspeed# + (playerspeed/2) + random#
score=score+1
endif
if sprite collision(enemy,ball)
ballxspeed#=0.0-(abs(ballxspeed#)+ballinc#)
random#=(rnd(10)-5)/10.0:ballyspeed#=ballyspeed# + (enemyspeed/2) + random#
endif
sync
until ballx# > 640.0 or ballx# 1 and level# = 0.0
enemyspeed#=0.0-enemymove#:endif:if playery# 480.0-levelline# then playery#=480.0-levelline#:if enemyy# 380.0 then enemyy#=380.0:if bally# 465.0 then ballyspeed# = 0.0-ballyspeed#:playery#=playery#+playerspeed#:enemyy#=enemyy#+enemyspeed#:ballx#=ballx#+ballxspeed#
bally#=bally#+ballyspeed#:sprite player,playerx#,playery#,player:sprite enemy,enemyx#,enemyy#,enemy:sprite ball,ballx#,bally#,ball:if sprite collision(player,ball)
ballxspeed#=0.0+(abs(ballxspeed#)+ballinc#):random#=(rnd(10)-5)/10.0:ballyspeed#=ballyspeed# + (playerspeed/2) + random#:score=score+1:endif
if sprite collision(enemy,ball):ballxspeed#=0.0-(abs(ballxspeed#)+ballinc#):random#=(rnd(10)-5)/10.0:ballyspeed#=ballyspeed# + (enemyspeed/2) + random#
endif:sync:until ballx# > 640.0 or ballx#
We're all Christ and we're all Hitler.We want Christ to win.What would he've done if he had advertisements, T.V. and newspapers?The miracle today is communication.So let's use it.-John Lennon '69
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 2nd Apr 2003 18:33
hmmm 20 line entry....should be post in 20 line challenge board ... no?
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 2nd Apr 2003 18:54
Oh stupid site, there was more on this post

I'll try again:

This version is to large but works fine:



This is a 19 line version, but the ball won't move to me and I can't move my racket:



We're all Christ and we're all Hitler.We want Christ to win.What would he've done if he had advertisements, T.V. and newspapers?The miracle today is communication.So let's use it.-John Lennon '69
DangYankee
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: United States
Posted: 2nd Apr 2003 18:55 Edited at: 2nd Apr 2003 18:57
Representing the most official unoffical unsanctioned authority here who has no authority -- You may post it in the 20 line challenge.
You may commense with the posting. As long as it's only 20 lines.

Wait a min... I could not get it to run with either DB or PRO , probally a formatting error. I'll let you sort that out.

hah we posted pretty much at the same time, never mind.

It's not the size of your code but how efficiently you use it!
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 2nd Apr 2003 18:55
Yo it works fine now, a miricle

Time to fix this forum

We're all Christ and we're all Hitler.We want Christ to win.What would he've done if he had advertisements, T.V. and newspapers?The miracle today is communication.So let's use it.-John Lennon '69
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 2nd Apr 2003 18:58
Yes the problem is that the 20 line version won't work, the readeble version works fine for me, what did I do wrong by making it 20 lines???

We're all Christ and we're all Hitler.We want Christ to win.What would he've done if he had advertisements, T.V. and newspapers?The miracle today is communication.So let's use it.-John Lennon '69
DangYankee
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: United States
Posted: 2nd Apr 2003 19:36
I got it to work in 20 lines but I can't figure out how to post it here -- it keeps messing up. Anyway I e-mailed it to ya.

It's not the size of your code but how efficiently you use it!
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 2nd Apr 2003 20:57
Thank you

We're all Christ and we're all Hitler.We want Christ to win.What would he've done if he had advertisements, T.V. and newspapers?The miracle today is communication.So let's use it.-John Lennon '69

Login to post a reply

Server time is: 2024-11-24 09:02:55
Your offset time is: 2024-11-24 09:02:55