Page 1 of 1

Newton

Posted: Tue Jan 12, 2010 9:32 am
by peter
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


Re: Newton

Posted: Wed Jan 13, 2010 12:40 am
by peter
Hi Dibalo,

what is the difference between this both?

Re: Newton

Posted: Wed Jan 13, 2010 1:17 am
by Dibalo
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.