fb:porticula NoPaste
physics.bi
Uploader: | flo |
Datum/Zeit: | 15.12.2007 15:22:55 |
type TPhysics 'Alles was man f�r die
x as double 'Berechnungen braucht:
y as double 'x- und y-Koordinaten,
ax as double 'Beschleunigung in
ay as double 'beide Richtungen
vx as double 'Jetzige und vorherige
vy as double 'Geschwindigkeiten
vxalt as double
vyalt as double
xalt as double
yalt as double
width as integer
height as integer
obx as integer
oby as integer
direction as byte
walkstatus as byte
maxwalkstatus as byte
walktime as double
walkspeed as single
move as byte
nowmove as byte
omove as byte
stupid as byte
vxvorher as byte
unverwundbarende as double
unverwundbartime as double
xplus as integer
xminus as integer
yplus as integer
yminus as integer
energy as integer
end type
declare sub move (byref object as TPhysics,d_T as double)
declare function deltaT as double
dim shared Figur as TPhysics
dim shared badguy as TPhysics
dim shared flachdepp as TPhysics
function deltaT as double
static altezeit as double
deltaT=timer-altezeit
altezeit=timer
end function
sub move (byref object as TPhysics,d_T as double)
with object
.vx=.vx+.ax*d_T
.vy=.vy+.ay*d_T
if .vx<0 then .direction=0:.nowmove=-.move
if .vx>0 then .direction=1:.nowmove=.move
if .vx=0 and .energy <>0 then .walkstatus=1 else if timer-.walktime>.walkspeed then .walktime=timer:.walkstatus+=1: if .walkstatus>.maxwalkstatus then .walkstatus=1
.xalt=.x
.yalt=.y
.x=.x+(.vxalt+.vx)/2*d_T
.y=.y+(.vyalt+.vy)/2*d_T
.vxalt=.vx
.vyalt=.vy
if .unverwundbarende<>0 then if timer > .unverwundbarende then .unverwundbarende=0
end with
end sub