English
Regulars table & Café

Collision with Collisionsrechteck to that evaluate

 
have time a small kollisionsroutine written with of/ one API-function.
thereby becomes as spending one Collisonsrechteck outputted , means The Überschneidungsfläche as values.
so can a good speedy Punkauswertung produce with XPIA/ASM and/or Profan2Cpp.
steer with the Keys QWES and only hinschauen. left have so did i The expanse in the Visier where The collision stattfindet.
One small Kontrollschirm with hpiccopy, was surprised wozu to the utilize can.
in the rectangle1# come The Collidaten, in the rectangle2# and rectangle3# come The Lagedaten the Collisionsrechtecke.

mfg
CompileMarkSeparation
 $H Windows.ph

proc collision

    StartPaint hintergr1&
    drawpic hintergr&,0,0;0
    DrawPic bild_block&,xx1&,yy1&;0
    DrawPic bild_auto&,x1&,y1&;0
    EndPaint
    StartPaint hwin&
    drawpic hintergr1&,200,20;0
    EndPaint
    deleteobject hbild&
    hbild&=create(hpiccopy,hintergr1&,&loop+150,150,150,150)
    startpaint hwin&
    drawpic hbild&,20,20;0
    endpaint

    With rechteck1#

        .x& = 0
        .y& = 0
        .w& = 0
        .h& = 0

    EndWith

    With rechteck2#

        .x& = x1&
        .y& = y1&
        .w& = x1&+64
        .h& = y1&+64

    EndWith

    With rechteck3#

        .x& = 200
        .y& = 200
        .w& = 264
        .h& = 264

    EndWith

    cls
    colli&=~IntersectRect(rechteck1#,rechteck2#,rechteck3#)
    print colli&
    print rechteck1#.x&; ;rechteck1#.y&; ;rechteck1#.w&; ;rechteck1#.h&

endproc

declare rechteck1#,rechteck2#,rechteck3#
declare x1&,y1&,xx1&,yy1&,colli&
declare hWin&,bild_auto&,bild_block&,hintergr& ,hintergr1&,ende& ,hbild&
Window 20,20-200,200
hWin& = Create(Window, %hWnd, Test, 250, 20, 650,500)
STRUCT rect = x&,y&,w&,h&
DIM rechteck1#, rect
DIM rechteck2#, rect
DIM rechteck3#, rect
bild_auto&=Create(hnewpic,64,64,$0000ff)
bild_block&=Create(hnewpic,64,64,$ff0000)
hintergr&=create(hnewpic,400,400,$00ffff)
hintergr1&=create(hnewpic,400,400,$00ffff)
ende& = 0
x1&=50
y1&=50
xx1&=200
yy1&=200
collision

WhileNot ende&

    sleep 1

    if isKey(65)

        ende& = 1

    endif

    if isKey(69)

        x1&=x1&+1
        collision

    endif

    if isKey(81)

        x1&=x1&-1
        collision

    endif

    if isKey(83)

        y1&=y1&+1
        collision

    endif

    if isKey(87)

        y1&=y1&-1
        collision

    endif

EndWhile

End
 
02/28/09  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.646 Views

Themeninformationen

this Topic has 1 subscriber:

unbekannt (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie