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.

Code Snippets / Shuffleboard game!

Author
Message
Chessplayer
21
Years of Service
User Offline
Joined: 22nd Dec 2002
Location:
Posted: 31st Mar 2003 03:28
This is my first game that I have made with DarkBasic! You move the ball up and down with the mouse. Hold down the mouse button to charge-up the power for the ball and then let go! (0 = no power. 100 = maximum power) If you can land it inside the first triangle, you get 10 points. If you land it in the midsegment of the triangle, you get 8 points. If you land it in the last part of the triangle, you get 7 points. If the ball goes past the triangle, 10 points are subtracted from your score! You have four tries! This game is pretty tricky!
I tried to write it under 20 lines with colons, but that messed up the code . Otherwise, I would post it there. Tell me what you think of it!

sync on
circle 8,8,8
get image 1,0,0,16,17
sprite 1,8,53,1
cls
line 23,5,23,95
line 0,5,586,5
line 0,95,586,95
line 428,5,428,95
line 473,5,473,95
line 518,5,518,95
line 563,5,563,95
line 428,53,563,5
line 428,53,563,95
line 473,53,563,53
get image 2,0,0,586,96
sprite 2,0,0,2
cls
Position mouse 8,53
circlex# = 8
circley# = 53
turns = 4
speed# = 0
score = 0

Do
If speed# = 0 then circley# = mousey()
If mouseclick() = 1
set cursor 5,400
speed# = speed# + 0.5
If speed# > 100 then speed# = 100
cls
print speed#
endif
If speed# > 1 and mouseclick() = 0 and turns > 0
speed# = speed#/10

While speed# > 0.9
a = 1
speed# = speed# - 0.08
circlex# = speed# + circlex#
sprite 1,circlex#,circley#,1
sleep 10
Endwhile
speed# = 0
If circlex# >= 447 and circlex = 44 and circley# = 473 and circlex# = 27 and circley# = 518 and circlex# = 17 and circley# = 477 and circlex# = 54 and cirlcey# = 520 and circlex# = 54 and circley# 563 then score = score - 10
cls
print score
sleep 1000

Position mouse 8,53
circlex# = 8
circley# = 53
sprite 1,circlex#,circley#,1
turns = turns - 1
endif
If turns = 0 and a = 1
set cursor 10,10
print "Game over!"
cls
endif
If circley# > 77 then circley# = 77
IF circley#
Chess isn't just for old, wise men! (really!)
Chessplayer
21
Years of Service
User Offline
Joined: 22nd Dec 2002
Location:
Posted: 31st Mar 2003 03:33
Oh, yeah, I forgot to say that I made this with regular DB.

Chess isn't just for old, wise men! (really!)
Easily Confused
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 31st Mar 2003 07:01
Erm!...You also forgot the rest of your post

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Chessplayer
21
Years of Service
User Offline
Joined: 22nd Dec 2002
Location:
Posted: 31st Mar 2003 20:58
LOL, sorry about that! I didn't copy some of it for some reason.

sync on
circle 8,8,8
get image 1,0,0,16,17
sprite 1,8,53,1
cls
line 23,5,23,95
line 0,5,586,5
line 0,95,586,95
line 428,5,428,95
line 473,5,473,95
line 518,5,518,95
line 563,5,563,95
line 428,53,563,5
line 428,53,563,95
line 473,53,563,53
get image 2,0,0,586,96
sprite 2,0,0,2
cls
Position mouse 8,53
circlex# = 8
circley# = 53
turns = 4
speed# = 0
score = 0

Do
If speed# = 0 then circley# = mousey()
If mouseclick() = 1
set cursor 5,400
speed# = speed# + 0.5
If speed# > 100 then speed# = 100
cls
print speed#
endif
If speed# > 1 and mouseclick() = 0 and turns > 0
speed# = speed#/10

While speed# > 0.9
a = 1
speed# = speed# - 0.08
circlex# = speed# + circlex#
sprite 1,circlex#,circley#,1
sleep 10
Endwhile
speed# = 0
If circlex# >= 447 and circlex <= 457 and circley# >= 44 and circley# <= 45 then score = score + 10
If circlex# >= 473 and circlex# <= 502 and circley# >= 27 and circley# <= 37 then score = score + 8
If circlex# >= 518 and circlex# <= 550 and circley# >= 17 and circley# <= 37 then score = score + 7
If circlex# >= 477 and circlex# <= 502 and circley# >= 54 and cirlcey# <= 60 then score = score + 8
If circlex# >= 520 and circlex# <= 546 and circley# >= 54 and circley# <= 74 then score = score + 7
If circlex# > 563 then score = score - 10
cls
print score
sleep 1000

Position mouse 8,53
circlex# = 8
circley# = 53
sprite 1,circlex#,circley#,1
turns = turns - 1
endif
If turns = 0 and a = 1
set cursor 10,10
print "Game over!"
cls
endif
If circley# > 77 then circley# = 77
IF circley# < 5 then circley# = 5
sprite 1,circlex#,circley#,1
sync
loop

Chess isn't just for old, wise men! (really!)
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 1st Apr 2003 23:10
You should use a code box:



"All programmers are playwrights and all computers are lousy actors." -Anon.

<--- Ouch, my head!

Login to post a reply

Server time is: 2024-11-24 04:48:29
Your offset time is: 2024-11-24 04:48:29