Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
little game of chance
Author Message
apomb

Posted: Fri Feb 27, 2004 10:34 am   Post subject: little game of chance

This is probly the most primitive and non-good looking game ever, but i was just playing around with different speeds and angles when the ball bounces off the wall... just for fun!
 code: %Adrian Pomber % The "wallgame" program. View.Set ("graphics, nooffscreenonly") var x : int var y : int var speed, speed2 : int var top, left, bottom, right : int := 0 put "Set initial speed: ".. get speed speed2 := speed+2 put "Enter starting position: " put "x: " .. get x put "y: " .. get y loop     exit when x >maxx or x <=0 and y <0     delay (10)     cls     Draw.FillOval (x, y, 10, 10, black)     x += speed     y += speed2     if (x) <= 0 then         speed := -speed - Rand.Int (1, 5)         left += 1     end if     if (x) >= maxx - 10 then         speed := -speed - Rand.Int (1, 5)         right += 1     end if     if (y) <= 0 then         speed2 := -speed2 - Rand.Int (1, 5)         bottom += 1     end if     if (y) >= maxy - 10 then         speed2 := -speed2 - Rand.Int (1, 5)         top += 1     end if end loop cls put "You hit the top wall ", top, " times" put "You hit the bottom wall ", bottom, " times" put "You hit the left wall ", left, " times" put "You hit the right wall ", right, " times" if top >= 1 and bottom >= 1 and right >= 1 and left >= 1 then     put "You hit all walls!!" end if

shorthair

Posted: Fri Feb 27, 2004 3:31 pm   Post subject: (No subject)

nice and fun , i had to imrove it before i played it to make it cooler, but your made a very entertaining game
Paul

Posted: Fri Feb 27, 2004 5:15 pm   Post subject: (No subject)

Is it just me, or does it speed up? Oh and it hit the bottom wall and went thru, and disappeared. Then It said I hit the bottom wall 450 times.
Cervantes

Posted: Fri Feb 27, 2004 5:44 pm   Post subject: (No subject)

Yes I'm getting the same problem with the bottom wall. Hit it 538 times

is that supposed to happen? Where is the game aspect?
shorthair

Posted: Fri Feb 27, 2004 5:46 pm   Post subject: (No subject)

hence , the " i had to change some thing to make it cooler , "
apomb

Posted: Fri Feb 27, 2004 6:59 pm   Post subject: (No subject)

well i just sorta threw it together last night and thought it would be entertaining for poeple to do ... and improve if you wanted.
Paul

Posted: Fri Feb 27, 2004 10:33 pm   Post subject: (No subject)

I'd give you bits if you can make a flower or something popup wherever it hits on the wall.
the_short1

Posted: Sat Feb 28, 2004 12:24 am   Post subject: (No subject)

good job there compwizz... good for a one nighter.... (i made my rock paper scissors in like 2 days... cuz some guy was playing that with his hands in my comp sci class...)....

here i added a impact identifier...

....yea... point cervantes.... someone above asked for one with an impact identifier... so i did it for compwizz

wallzzzz.t
Description:
Filename:  wallzzzz.t
Filesize:  1.33 KB

Cervantes

Posted: Sat Feb 28, 2004 11:43 am   Post subject: (No subject)

um, how's that better than what he had? all you did is draw a huge oval when it hits the wall and add a small delay...
apomb

Posted: Sat Feb 28, 2004 3:20 pm   Post subject: (No subject)

Well , is this one better? ... theres no cls ... it shows you where you hit the wall with a STAR.
 code: %Adrian Pomber % The "wallgame" program. View.Set ("graphics, nooffscreenonly") var x, y, j, k, i, h, q, w, r, e, t, u, z, b, n, m, s, d : int := 0 var speed, speed2 : int var top, left, bottom, right : int := 0 colorback (black) cls color (white) Text.Locate (10, 32) put "Set initial speed: " .. get speed speed2 := speed + 2 Text.Locate (11, 32) put "Enter starting position: " Text.Locate (12, 32) put "x: " .. get x Text.Locate (13, 32) put "y: " .. get y loop     exit when top > 2 or bottom > 2 or right > 2 or left > 2 or (top >= 1 and bottom >= 1 and right >= 1 and left >= 1)     Draw.FillOval (x, y, 10, 10, 42)     drawfillstar (j, h, k, i, yellow)     drawfillstar (q, w, r, e, yellow)     drawfillstar (t, u, z, b, yellow)     drawfillstar (s, d, n, m, yellow)     View.Update     delay (10)     View.Update     cls     x += speed     y += speed2     if (x) <= 0 then         speed := -speed - Rand.Int (1, 5)         left += 1         j := x - 20         h := y - 20         k := x + 20         i := y + 20         drawfillstar (j, h, k, i, yellow)         sound (1000, 50)     end if     if (x) >= maxx - 10 then         speed := -speed - Rand.Int (1, 5)         right += 1         q := x - 20         w := y - 20         r := x + 20         e := y + 20         drawfillstar (q, w, r, e, yellow)         sound (1000, 50)     end if     if (y) <= 0 then         speed2 := -speed2 - Rand.Int (1, 5)         bottom += 1         t := x - 20         u := y - 20         z := x + 20         b := y + 20         drawfillstar (t, u, z, b, yellow)         sound (1000, 50)     end if     if (y) >= maxy - 10 then         speed2 := -speed2 - Rand.Int (1, 5)         top += 1         s := x - 20         d := y - 20         n := x + 20         m := y + 20         drawfillstar (s, d, n, m, yellow)         sound (1000, 50)     end if end loop cls put "You hit the top wall ", top, " times" put "You hit the bottom wall ", bottom, " times" put "You hit the left wall ", left, " times" put "You hit the right wall ", right, " times" if top >= 1 and bottom >= 1 and right >= 1 and left >= 1 then     delay (1000)     cls     colorback (black)     cls     color (white)     Text.Locate (10, 32)     put "You hit all the walls!!" .. end if
programer007

Posted: Sun Mar 07, 2004 5:51 pm   Post subject: (No subject)

thats a cool program... it reminds me of 'Bounce' program from book, only that one was for text...this is graphics... here +2 bits..
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 11 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: