Newton

Do you have something to share with us? A tip for newbies, perhaps? Post it here.

Newton

Postby peter » Tue Jan 12, 2010 9:32 am

For own games or for fun.
A little bit physics.

Code: Select all
SCREEN 300,300,16,2
FrameLimit 25

Global x,y,r,yvel,xyel,yacc,Font
x =20 : y =100 : r =10 : yvel =-10.0 : xvel =10.0 : yacc =.98

Font = LoadFont("comic.ttf ",24)
SetFont Font

While KeyDown(1) = False
ClsColor 0,120,205
yvel = yvel + yacc
y = y + yvel
x = x + xvel
If y > 289 Then
yvel = -0.9 * yvel : y = 289 : xvel = xvel * 0.9
End If
If x > 285 Then
xvel = -xvel : x = 285
End If
If x < 10  Then
xvel = -xvel : x = 10
End If
Color 255,255,0
Text 68,8,"Something Newton"
DrawBall()
If xvel * xvel < 0.0001 Then 
Exit
End If
DrawScreen
Wend
End

Function DrawBall()
color 0,200,100
Circle x, y, r, 1
color 255,0,0
Circle x, y, r - 2
End Function


Best Regards.

EDIT:

Use code tags instead of quote tags next time, please.
-Dibalo

peter
Member
 
Posts: 64
Joined: Mon Oct 22, 2007 1:31 pm

Re: Newton

Postby peter » Wed Jan 13, 2010 12:40 am

Hi Dibalo,

what is the difference between this both?
peter
Member
 
Posts: 64
Joined: Mon Oct 22, 2007 1:31 pm

Re: Newton

Postby Dibalo » Wed Jan 13, 2010 1:17 am

Hi peter,

Code tags are designed for displaying source codes. As you can see, the result is much better looking than using a quote. It is easy to copy (thanks to the 'select all' button) codes and source codes takes less space. Thats why (imho) it's easier to read your post and to figure out the main points from it.
Dattebayo!!
ChaosBasic 0.2.1: In development - ||||||||||
User avatar
Dibalo
Moderator
Moderator
 
Posts: 287
Joined: Mon Aug 27, 2007 7:12 pm
Location: Espoo, Finland


Return to Examples and tutorials

Who is online

Users browsing this forum: No registered users and 1 guest