problem mit schuss\neues problem
Übersicht

masterman123Betreff: problem mit schuss\neues problem |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
der schuss wird nicht angezeigt
Code: [AUSKLAPPEN] Graphics3D 800,600,32,1
SetBuffer BackBuffer() Type Schuss Field Entity End Type Global magazin=10 Global waffea=1 ;;;;;terrain Global terr=LoadTerrain("heightmap1.bmp") tex=LoadTexture("coolgrass2.bmp") tex1=LoadTexture("gras.bmp") tex2=LoadTexture("mapt1.bmp") EntityTexture terr,tex,0,0 EntityTexture terr,tex1,0,1 EntityTexture terr,tex2,0,2 ScaleEntity terr,20,100,20 PositionEntity terr,-20*600,0,-20*600 EntityType terr,2 ;;;;wasser Global wasser=CreatePlane() wassertex=LoadTexture("water.bmp") EntityTexture wasser,wassertex,0,0 ScaleTexture wassertex,100,100 MoveEntity wasser,0,1,0 EntityAlpha wasser,0.5;durchsichtigkeit ;;;;kamera Global cam=CreateCamera() PositionEntity cam,0,108.5,0 CameraFogMode cam,1;nebel an\aus CameraFogRange cam,100,4000 CameraFogColor cam,40,140,255 CameraRange cam,1,100000 CameraClsColor cam,40,140,255 ;;;;;licht light=CreateLight() TurnEntity light,45,45,0 ;;;;;würfel camparent=CreateCube() ScaleEntity camparent,0.1,0.1,0.1 PositionEntity camparent,0,100,0 EntityType camparent,1 EntityParent cam,camparent EntityAlpha camparent,0 ;;;;;waffe waffe=LoadMesh("w_fiveseven.3ds") PositionEntity waffe,3,107,5 RotateEntity waffe,105,0,270 EntityParent waffe,cam ScaleMesh waffe,0.2,0.2,0.2 HideEntity waffe waffe1=LoadMesh("w_mp51.3ds") waf=LoadTexture("w_mp510.bmp") waf1=LoadTexture("w_mp511.bmp") waf2=LoadTexture("w_mp512.bmp") waf3=LoadTexture("w_mp513.bmp") waf4=LoadTexture("w_mp514.bmp") waf5=LoadTexture("w_mp515.bmp") EntityTexture waffe1,waf,0,0 EntityTexture waffe1,waf1,0,1 EntityTexture waffe1,waf2,0,2 EntityTexture waffe1,waf3,0,3 EntityTexture waffe1,waf4,0,4 EntityTexture waffe1,waf5,0,5 PositionEntity waffe1,4.5,107,3.5 RotateEntity waffe1,100,0,90 EntityParent waffe1,cam ScaleMesh waffe1,0.2,0.15,0.15 HideEntity waffe1 ;;;;mauszeiger cursor=LoadImage("maus.bmp") ;;;;;funktion Function NeuerSchuss() S.Schuss = New Schuss S\Entity =CreateSphere(21) ScaleEntity S\Entity, 0.1, 0.1, 0.5 PositionEntity S\Entity,0,108.5,0 RotateEntity S\Entity,0,0,0 EntityRadius S\Entity, 0.1 End Function Collisions 1,2,2,2 EnableDirectInput(1) ;;;;hauptschleife While Not KeyHit(1) ;;;;steurung If KeyDown(17) Then MoveEntity camparent,0,0,0.5 EndIf If KeyDown(31) Then MoveEntity camparent,0,0,-0.5 EndIf If KeyDown(30) Then MoveEntity camparent,-0.5,0,0 EndIf If KeyDown(32) Then MoveEntity camparent,0.5,0,0 EndIf If KeyHit(2) Then waffea=1 magazin=10 EndIf If KeyHit(3) Then magazin=100 waffea=2 ShowEntity waffe1 HideEntity waffe EndIf If waffea=1 Then ShowEntity waffe HideEntity waffe1 If MouseHit(1) magazin=magazin-1 EndIf If magazin<0 Then magazin=0 EndIf If KeyHit(19) Then magazin=10 EndIf EndIf If waffea=2 Then If MouseDown(1) magazin=magazin-1 EndIf If magazin<0 Then magazin=0 EndIf If KeyHit(19) Then magazin=100 EndIf EndIf If KeyHit(57) Then ;wenn leertaste gedrückt wird dann If Magazin > 0 Then NeuerSchuss();ist das magazin >0 dann neuerschuss(funktion) EndIf ;;;;maussteuerung TurnEntity camparent,0,EntityYaw(cam)-MouseXSpeed(),0 RotateEntity cam,EntityPitch(cam)+MouseYSpeed(),0,0 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 For T.Schuss = Each Schuss MoveEntity T\Entity,0,0, 1.5;bewegt das objekt RotateEntity T\Entity,180,0,0 EntityParent T\Entity, cam If EntityDistance (T\Entity, cam) > 100 Then;ist der abstand vom schuss und dem flugzeug höher als 100 dann HideEntity T\Entity;versteckt das objekt Delete T.Schuss;löscht das objekt EndIf Next RenderWorld() ;;;;collision If EntityCollided(camparent,2) Then TranslateEntity camparent,0,0,0 Else TranslateEntity camparent,0,-1,0 EndIf UpdateWorld() Text 300,0,"Drücke 1-9 um Waffen zuwechseln!" Text 200,20,"Schießen mit der linken Maustaste und Nachladen mit R !" Text 20,30,magazin If magazin=0 Then Text 350,300,"Drücke R um Nachzuladen!" DrawImage cursor,GraphicsWidth()/2,GraphicsHeight()/2 Flip Wend ClearWorld() End danke schonmal edit: guckt nach unten |
||
- Zuletzt bearbeitet von masterman123 am Do, Jan 07, 2010 19:10, insgesamt 2-mal bearbeitet
![]() |
Nicdel |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] PositionEntity S\Entity,0,108.5,0
Sicher, dass das die richtige Position ist? |
||
Desktop: Intel Pentium 4 2650 Mhz, 2 GB RAM, ATI Radeon HD 3850 512 MB, Windows XP
Notebook: Intel Core i7 720 QM 1.6 Ghz, 4 GB DDR3 RAM, nVidia 230M GT, Windows 7 |
masterman123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
nich so richtig
aber es ja parent zu cam und cam parent zu camparent und camparent hat ne schwerkraft edit:jetzt seh ich ihn |
||
masterman123 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
neuer fehler mit anderen schuss
Code: [AUSKLAPPEN] Graphics3D 800,600,32,1
SetBuffer BackBuffer() Type Schuss ;ist eigentlich klar ... Field x Field y Field z Field s End Type Global magazin=10 Global waffea=1 ;;;;;terrain Global terr=LoadTerrain("heightmap1.bmp") tex=LoadTexture("coolgrass2.bmp") tex1=LoadTexture("gras.bmp") tex2=LoadTexture("mapt1.bmp") EntityTexture terr,tex,0,0 EntityTexture terr,tex1,0,1 EntityTexture terr,tex2,0,2 ScaleEntity terr,20,100,20 PositionEntity terr,-20*600,0,-20*600 EntityType terr,2 ;;;;wasser Global wasser=CreatePlane() wassertex=LoadTexture("water.bmp") EntityTexture wasser,wassertex,0,0 ScaleTexture wassertex,100,100 MoveEntity wasser,0,1,0 EntityAlpha wasser,0.5;durchsichtigkeit ;;;;kamera Global cam=CreateCamera(campivot) PositionEntity cam,0,108.5,0 CameraFogMode cam,1;nebel an\aus CameraFogRange cam,1,9000 CameraFogColor cam,40,140,255 CameraRange cam,1,9000 CameraClsColor cam,40,140,255 ;;;;;licht light=CreateLight() TurnEntity light,45,45,0 ;;;;;würfel camparent=CreateCube() ScaleEntity camparent,0.1,0.1,0.1 PositionEntity camparent,0,100,0 EntityType camparent,1 EntityParent cam,camparent EntityAlpha camparent,0 ;;;;;waffe waffe=LoadMesh("w_fiveseven.3ds") PositionEntity waffe,3.5,107,5 RotateEntity waffe,105,0,270 EntityParent waffe,cam ScaleMesh waffe,0.2,0.2,0.2 HideEntity waffe waffe1=LoadMesh("w_mp51.3ds") waf=LoadTexture("w_mp510.bmp") waf1=LoadTexture("w_mp511.bmp") waf2=LoadTexture("w_mp512.bmp") waf3=LoadTexture("w_mp513.bmp") waf4=LoadTexture("w_mp514.bmp") waf5=LoadTexture("w_mp515.bmp") EntityTexture waffe1,waf,0,0 EntityTexture waffe1,waf1,0,1 EntityTexture waffe1,waf2,0,2 EntityTexture waffe1,waf3,0,3 EntityTexture waffe1,waf4,0,4 EntityTexture waffe1,waf5,0,5 PositionEntity waffe1,4.5,107,3.5 RotateEntity waffe1,100,0,90 EntityParent waffe1,cam ScaleMesh waffe1,0.2,0.15,0.15 HideEntity waffe1 ;;;;mauszeiger cursor=LoadImage("maus.bmp") Collisions 1,2,2,2 EnableDirectInput(1) ;;;;hauptschleife While Not KeyHit(1) ;;;;steurung If KeyDown(17) Then MoveEntity camparent,0,0,0.5 EndIf If KeyDown(31) Then MoveEntity camparent,0,0,-0.5 EndIf If KeyDown(30) Then MoveEntity camparent,-0.5,0,0 EndIf If KeyDown(32) Then MoveEntity camparent,0.5,0,0 EndIf If KeyHit(2) Then waffea=1 magazin=10 EndIf If KeyHit(3) Then magazin=100 waffea=2 ShowEntity waffe1 HideEntity waffe EndIf If waffea=1 Then ShowEntity waffe HideEntity waffe1 If MouseHit(1) magazin=magazin-1 EndIf If magazin<0 Then magazin=0 EndIf If KeyHit(19) Then magazin=10 EndIf EndIf If waffea=2 Then If MouseDown(1) magazin=magazin-1 EndIf If magazin<0 Then magazin=0 EndIf If KeyHit(19) Then magazin=100 EndIf EndIf If MouseDown(1) Then ;[Alt] s.schuss = New Schuss ;Neuer schuss erstellen s\s = LoadSprite("schuss.bmp") ;Schuss-Sprite laden s\x = EntityX(camparent) ;x,y und z Koordinate von der Figur speichern s\y = EntityY(camparent) s\z = EntityZ(camparent) PositionEntity s\s,s\x,s\y+6.5,s\z+3 ;Schuss an die Figurposition positionieren RotateEntity s\s ,EntityPitch(cam),EntityYaw(camparent),EntityRoll(cam) ;Schuss in die Richtige Richtung drehen End If ;------------------------------------------------------- For s.schuss = Each schuss MoveEntity s\s,0,0,5 ;Jeder Schuss um 5 Einheiten nach vorne verschieben Next ;;;;maussteuerung TurnEntity camparent,0,EntityYaw(cam)-MouseXSpeed(),0 RotateEntity cam,EntityPitch(cam)+MouseYSpeed(),0,0 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 RenderWorld() ;;;;collision If EntityCollided(camparent,2) Then TranslateEntity camparent,0,0,0 Else TranslateEntity camparent,0,-1,0 EndIf UpdateWorld() Text 300,0,"Drücke 1-9 um Waffen zuwechseln!" Text 200,20,"Schießen mit der linken Maustaste und Nachladen mit R !" Text 20,30,magazin If magazin=0 Then Text 350,300,"Drücke R um Nachzuladen!" DrawImage cursor,GraphicsWidth()/2,GraphicsHeight()/2 Flip Wend ClearWorld() End ich hab ja einen würfel damit die camera höher ist und den dreh ich mit der maus auf der x achse und die camera mit der maus auf der y achse sie sind ja parent die cam zum würfel und wenn ich jetzt den schuss schieße und dann mit der maus bewege (x achse) dreht sich der schuss ,ist aber nicht an der gleichen stelle wie vorher sondern weiter links in einer bestimmten richtung ist wieder normal, ein bisschen drehen ist er wieder woanders, brauche driengend hilfe danke schonmal |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group