Introducing BounCE
A fun bouncing ball simulator written in ICE. This is a lot like Bouncy Ball Simulator by _ipheonix_, except that it will not be as optimized, since it is be made by a beginner.

Features:
-The ability to accelerate the ball in any direction
-The ability to change the ball and background colors
-Change the ball from a circle to a square
-More features coming soon!

here is the code:

Code:
[i]A
Begin

55->GRAV->L1(1)
5->VAIR->L1(2)
5->HAIR->L1(3)

[i]---INTRO
FillScreen(0
SetTextBGColor(0
SetTextScale(6,6
SetTextFGColor(224
PrintStringXY("unCE",114,20
SetTextFGColor(24
PrintStringXY("Boun",18,20

SetTextScale(2,2
SetTextFGColor(31
PrintStringXY("A fun physics game",35,100
PrintStringXY("By Legoman314",98,130
SetTextFGColor(15
SetTextScale(1,1
PrintStringXY("Press [ENTER]",110,225


SetColor(15

For(Y,0,4000
   If getKey(9)=1:4000->Y
   End
End

For(Y,0,200,1
   FillCircle(160,120,Y
   Pause 1
End

[i]---SETUP
SetTextFGColor(112
SetTextTransparentColor(1
SetTextBGColor(0
0->XV->YV->X->Y->BC->T
1->C
20->S
15->FC
1->SETNUM
SetColor(255

Lbl MAINLOOP:getKey->K

[i]-------MAIN LOOP-------
While K!=15 and K!=55
   getKey->K
   [i]---ACCELERATION
   If getKey(1)=1:YV+100->YV
   End
   If getKey(2)=1:XV-100->XV
   End
   If getKey(3)=1:XV+100->XV
   End
   If getKey(4)=1:YV-100->YV
   End
   
   [i]---SIZE
   If getKey(54)=1:min(239,S+1)->S
   End
   If getKey(48)=1:max(1,S-1)->S
   End
   
   [i]---COLOR
   If getKey(40)=1:FC+1->FC
   End
   If getKey(32)=1:BC-1->BC
   End
   
   [i]---CIRCULARITY
   If K=47:not(C)->C
   End
   
   [i]---RESET
   If getKey(53)=1:0->X->Y->XV->YV->BC:20->S:15->FC
   End
   
   
   [i]---TIMEOUT
   If K!=0:0->T
   End
   If T>=700:15->K
   End
   
   X+((2*(XV<8388608)-1)*((sqrt(XV*XV)/100))->X
   Y+((2*(YV<8388608)-1)*((sqrt(YV*YV)/100))->Y
   
   [i]---COLLISION DETECTION
   If Y>500:0->Y:~1*YV->YV
   End
   If Y>240-S:240-S->Y:~1*YV->YV
   End
   If X>500:0->X:~1*XV->XV
   End
   If X>320-S:320-S->X:~1*XV->XV
   End
   
   [i]---RENDERING
   SetDraw(1
   FillScreen(BC
   SetColor(FC
   
   If C=1:FillCircle(X+S/2,Y+S/2,S/2-1
   End
   If C!=1:FillRectangle(X,Y,S,S
   End
   
   SetTextXY(10,10
   [i]PrintUInt(K,2
   SetTextXY(10,25
   [i]PrintUInt(YV,2
   
   SwapDraw
   
   T+1->T
   [i]---GRAVITY/AIR RESITANCE
   YV+GRAV->YV
   YV+(2*(YV>8388608)-1)*VAIR->YV
   XV+(2*(XV>8388608)-1)*HAIR->XV
End

If K=55:Goto SETTINGS
End
If K=15:Goto EXIT
End

[i]-------SETTINGS--------
Lbl SETTINGS:0->K:1->SETNUM:1->L1(1)

[i]---BACKGROUND
SetColor(FC
FillRectangle(0,0,320,240
SetColor(0
FillRectangle(6,6,308,228
SetTextFGColor(87
SetTextScale(4,4
PrintStringXY("SETTINGS",32,10

While K!=15 and K!=55
   [i]---NAVIGATION
   If K=2:L1(1)-1->L1(1)
   End
   If K=3:L1(1)+1->L1(1)
   End
   
   [i]---MENU
   SetTextScale(1,1
   SetTextFGColor(23
   
   
   [i]-BACKGROUN DRAW
   FillRectangle(6,6,308,228
   
   [i]-GRAVITY
   PrintStringXY("GRAVITY: <        >",15,50
   SetTextXY(83,50
   [i]L1(1)->B
   PrintUInt(L1(1),3
   
   
   
   SwapDraw
End

Goto MAINLOOP

Lbl EXIT:
det(1


To do:
-Fix any bugs

Feel free to post suggestions and/or helpful comments.
If you had posted this two days earlier, you would have been on the one-year anniversary of that program. Wow, time flies.

In my development of BBS, I had a little menu where I could tweak some of the constants in the game. I think it'd be great for your program if you had your own menu where you could change the constants used in the program. (Stuff like gravity, force applied, friction, air resistance, etc)
Legoman314 wrote:
Feel free to post suggestions and/or helpful comments.

Yeah, why don't you use SourceCoder like a normal person so we can see what those commands are rather than those det( statements.
MateoConLechuga wrote:
Legoman314 wrote:
Feel free to post suggestions and/or helpful comments.

Yeah, why don't you use SourceCoder like a normal person so we can see what those commands are rather than those det( statements.


Thanks for pointing that out, Mateo, I went and converted all the det( statements to commands. Smile
Legoman314 wrote:
Thanks for pointing that out, Mateo, I went and converted all the det( statements to commands. Smile

Yay thanks! I just tried it out and it's pretty nifty Razz I like the gravity simulation.
Yay! My first program, BounCE just got accepted to the archives. Go check it out and see if you like it. Also, if you find any bugs, please tell me. Thanks.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement