Problem mit zivi collis
Übersicht

![]() |
dimasterBetreff: Problem mit zivi collis |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] Graphics3D 640,480,16,1 SetBuffer BackBuffer() Dim schuss#(50,3) Dim shot(50) Dim map(200,200) Dim zivi(500,5) Global px,ppx Global py,ppy Global x,y Global zivicounter,zivi_anzahl,zivi_bewegung Global scrollx,scrolly Global p_bewegung,p_richtung,q Global mx#,my#,winkel Global zivi_scrollx,zivi_scrolly,zivi_q Global blabla1,blabla2 tile = LoadAnimImage("gfx/tileset2.bmp",32,32,0,47) mann = LoadImage("gfx/man1.bmp") maus = LoadImage("gfx/maus.bmp") kugel= LoadImage("gfx/kugel.bmp") LoadMap() Global player=LoadSprite("gfx/p.bmp",4) ScaleSprite player,-32,-32 PositionEntity player,((ppx-scrollx)*2)-640+32,-((ppy-scrolly)*2)+480-32,640 cam=CreateCamera() CameraClsMode cam,0,1 CameraRange cam,1,700 PositionEntity cam,-3,-3,0 AutoMidHandle True SeedRnd MilliSecs() MidHandle maus px=9 py=8 ppx=9*32 ppy=8*32 SetzeZivis() While Not KeyHit(1) Cls Gosub MaleMap MalePlayer() Gosub MaleZivis Gosub ZiviMovement PlayerMovement() Gosub ErstelleSchuss Gosub MaleSchuss DrawImage maus,MouseX(),MouseY() UpdateWorld RenderWorld Flip Wend Function LoadMap() karte = ReadFile("map1.map") For x = 0 To 200 For y = 0 To 200 tile = ReadLine(karte) map(x,y) = ReadInt(karte) Next Next CloseFile(karte) End Function .MaleMap For y=0 To 200 For x=0 To 200 DrawImage tile,x*32-scrollx,y*32-scrolly,map(x,y) Next Next Return Function MalePlayer() mx# = MouseX() my# = MouseY() winkel = ATan2(mx-288,256-my) RotateSprite player,winkel*-1 PositionEntity player,((ppx-scrollx)*2)-640+32,-((ppy-scrolly)*2)+480-32,640 End Function Function SetzeZivis() zivicounter = 0 For i = 0 To 199 For j = 0 To 199 If Rand(1,2)=1 And zivicounter < 500 And map(i,j)=2 Then zivicounter = zivicounter+1 zivi(zivicounter,0)=1 zivi(zivicounter,1)=i*32 zivi(zivicounter,2)=j*32 zivi(zivicounter,3)=i zivi(zivicounter,4)=j zivi(zivicounter,5)=Rand(1,2) EndIf Next Next End Function .MaleZivis For sd=1 To zivicounter-1 If zivi(sd,0)=1 Then DrawImage mann,(zivi(sd,1))-scrollx,(zivi(sd,2))-scrolly EndIf Next Return Function PlayerMovement() If p_bewegung>0 Then If p_richtung=1 scrolly=scrolly-2 ppy=ppy-2 q=q+1 If q=16 Then p_bewegung=0 q=0 py=py-1 EndIf EndIf If p_richtung=2 scrolly=scrolly+2 ppy=ppy+2 q=q+1 If q=16 Then p_bewegung=0 q=0 py=py+1 EndIf EndIf If p_richtung=3 scrollx=scrollx-2 ppx=ppx-2 q=q+1 If q=16 Then p_bewegung=0 q=0 px=px-1 EndIf EndIf If p_richtung=4 scrollx=scrollx+2 ppx=ppx+2 q=q+1 If q=16 Then p_bewegung=0 q=0 px=px+1 EndIf EndIf EndIf If KeyDown(200) Then If map(px,py-1)<7 Then If p_bewegung<1 Then p_richtung=1 p_bewegung=1 EndIf EndIf EndIf If KeyDown(208) Then If map(px,py+1)<7 Then If p_bewegung<1 Then p_richtung=2 p_bewegung=1 EndIf EndIf EndIf If KeyDown(203) Then If map(px-1,py)<7 Then If p_bewegung<1 Then p_richtung=3 p_bewegung=1 EndIf EndIf EndIf If KeyDown(205) Then If map(px+1,py)<7 Then If p_bewegung<1 Then p_richtung=4 p_bewegung=1 EndIf EndIf EndIf End Function .ErstelleSchuss If MouseHit(1) nr=nr+1 schuss(nr,0)=1 schuss(nr,1)=ppx schuss(nr,2)=ppy schuss(nr,3)=winkel-90 EndIf If nr=50 Then nr=0 Return .MaleSchuss For i=0 To 50 If schuss(i,0)=1 DrawImage kugel,schuss(i,1)-scrollx,schuss(i,2)-scrolly schuss(i,1)=schuss(i,1)+(Cos(schuss(i,3)*-1)/10)*300 schuss(i,2)=schuss(i,2)-(Sin(schuss(i,3)*-1)/10)*300 EndIf Next Return .ZiviMovement For zivi_anzahl=0 To zivicounter-1 If zivi(zivi_anzahl,0)=1 Then If zivi(zivi_anzahl,5)=1 Then If map(zivi(zivi_anzahl,3),zivi(zivi_anzahl,4)-1)=2 Then If zivi_bewegung<1 Then zivi_bewegung=1 EndIf EndIf If zivi_bewegung>0 Then zivi_scrolly=zivi_scrolly-2 zivi(zivi_anzahl,2)=zivi(zivi_anzahl,2)-2 zivi_q=zivi_q+1 If zivi_q=16 Then zivi_bewegung=0 zivi(zivi_anzahl,4)=zivi(zivi_anzahl,4)-1 zivi_q=0 EndIf EndIf If map(zivi(zivi_anzahl,3),zivi(zivi_anzahl,4)-1)<>2 Then zivi(zivi_anzahl,5)=2 EndIf EndIf If zivi(zivi_anzahl,5)=2 Then If map(zivi(zivi_anzahl,3),zivi(zivi_anzahl,4)+1)=2 Then If zivi_bewegung<1 Then zivi_bewegung=1 EndIf EndIf If zivi_bewegung>0 Then zivi(zivi_anzahl,2)=zivi(zivi_anzahl,2)+2 zivi_scrolly=zivi_scrolly+2 zivi_q=zivi_q+1 If zivi_q=16 Then zivi_bewegung=0 zivi(zivi_anzahl,4)=zivi(zivi_anzahl,4)+1 zivi_q=zivi_q+1 EndIf EndIf EndIf EndIf Next Return schaut euch mal die stelle mit den zivi collis an.die funktionieren irgendwie net.könnt ihr mir helfen?die zivis sollen sich nur aufm tile 2 bewegen.was haben wir da falsch gemacht? |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group