ERLEDIGT
JA
JA
ANTWORTEN
1
1
ZUGRIFFE
751
751
EMPFEHLEN
-
01.12.11 14:17 #1
- Registriert seit
- May 2007
- Beiträge
- 18
Hallo, in meinem top down space shooter spiel kann man sich drehen und bewegt sich in die gedrehte richtung.
Nun kommt das problem:
Wenn ich 2 schüsse gleichzeitig abfeuern will also mit einem abstand dazwischen das sieht dann ca. so aus
Ungedreht:
![[XNA C#] Schüsse mit offset richtig positionieren?-ungedreht.jpg](http://www.tutorials.de/attachments/net-cafe/58911d1322823761t-ungedreht.jpg)
Stück Gedreht:
![[XNA C#] Schüsse mit offset richtig positionieren?-stueckgedreht.jpg](http://www.tutorials.de/attachments/net-cafe/58912d1322823761t-stueckgedreht.jpg)
Rechts:
![[XNA C#] Schüsse mit offset richtig positionieren?-rechts.jpg](http://www.tutorials.de/attachments/net-cafe/58913d1322823761t-rechts.jpg)
Wie ihr seht bewegen sich die schüsse immer mehr zusammen richtung mittelpunkt bis sie sich komplett überschneiden sobald das schiff nach rechts zeigt, aber wenn ich es weiter richtung unten drehe normalisiert es sich wieder.
und ich wollte fragen ob jemand weis wie man das problem beseitigen kann.
Die GunOffsets:
Code :1 2
private Vector2 gunOffset = new Vector2(2, 8); private Vector2 gunOffset2 = new Vector2(20, 8);
hier ist die funktion die die schüsse abfeuert im player manager:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
private void FireShot() { if (shotTimer >= minShotTimer) { PlayerShotManager.FireShot( playerSprite.Location + gunOffset, new Vector2((float)Math.Sin(playerSprite.Rotation), -(float)Math.Cos(playerSprite.Rotation)), true, speedMod); PlayerShotManager.FireShot( playerSprite.Location + gunOffset2, new Vector2((float)Math.Sin(playerSprite.Rotation), -(float)Math.Cos(playerSprite.Rotation)), true, speedMod); shotTimer = 0.0f; } }
Und die Shotmanager Fire Shot funktion:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
public void FireShot( Vector2 location, Vector2 velocity, bool playerFired, float speedMod) { Sprite thisShot = new Sprite( location, Texture, InitialFrame, velocity); thisShot.Velocity *= shotSpeed + speedMod; for (int x = 1; x < FrameCount; x++) { thisShot.AddFrame(new Rectangle( InitialFrame.X + (InitialFrame.Width * x), InitialFrame.Y, InitialFrame.Width, InitialFrame.Height)); } thisShot.CollisionRadius = CollisionRadius; Shots.Add(thisShot); }
danke im vorrausGeändert von BlackPsycho (01.12.11 um 14:34 Uhr)
-
07.12.11 11:36 #2
das thema scheint schon gelöst zu sein
http://www.xnamag.de/forum/viewtopic.php?t=5938
Ähnliche Themen
-
Div richtig Positionieren - Wie?
Von nchristoph im Forum CSSAntworten: 8Letzter Beitrag: 26.11.10, 10:44 -
Footer richtig positionieren, aber wie ?
Von raul25 im Forum CSSAntworten: 4Letzter Beitrag: 08.12.08, 21:15 -
div richtig positionieren?
Von unrealzero_php im Forum CSSAntworten: 2Letzter Beitrag: 05.01.07, 17:03 -
Divs richtig positionieren
Von paraphan im Forum CSSAntworten: 2Letzter Beitrag: 28.07.05, 08:50 -
Empfehlung für Schüsse?
Von nuVem im Forum 3D Studio MaxAntworten: 38Letzter Beitrag: 14.08.03, 16:45





Zitieren
Login





