Buchempfehlung
MySQL kurz & gut
MySQL kurz & gut
Das preiswerte Taschen- buch stellt MySQL-rele- vante Inhalte systematisch und knapp dar, sodass es sich optimal zum Nach- schlagen beim Pro- grammieren eignet. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

physics.bi

Uploader:Mitgliedflo
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