Problem bei einer explosion (ich glaube wegen Sinus/Cosinus)
Übersicht

![]() |
Kleiner satanBetreff: Problem bei einer explosion (ich glaube wegen Sinus/Cosinus) |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hallo,
wie der titel schon sagt will ich eine explosion in 2d machen aber irgentetwas stimmt dabei nicht... Code: [AUSKLAPPEN] Graphics 800,600,0,2 SetBuffer BackBuffer() SeedRnd MilliSecs()*3600 Type expl Field milli Field mitX Field mitY Field w Field explosion Field aktX Field aktY End Type counter = 0 Repeat Cls ;neu If KeyHit(57) Then startX = Rand(100,700) startY = Rand(100,500) counter = counter + 1 For i=1 To 100 var1.expl = New expl var1\milli = MilliSecs() var1\mitX = startX var1\mitY = startY var1\w# = Rand(0,360) var1\explosion = counter var1\aktX = startX var1\aktY = startY Next EndIf ;rendern For var1.expl = Each expl Line var1\aktX, var1\aktY,var1\aktX+20*Cos(var1\w),var1\aktY-20*Sin(var1\w) Next ;löschen For var1.expl = Each expl If (MilliSecs() - var1\milli) > 10000 Then Delete var1.expl Next ;updaten For var1.expl = Each expl var1\aktX = var1\aktX + Cos(var1\w) var1\aktY = var1\aktY - Sin(var1\w) Next Flip Delay 10 Until KeyHit(1) End ich vermute wegen sinus und cosinus aber ich kriegs einfach nicht hin...aber probiert das programm selber mal aus, dann wisst ihr was ich meine:? Bastian |
||
BIG BUG |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Das Problem ist, dass Deine Positionsvariablen Integer sind, Sin & Cos aber von 0-1 geht, also nur mit Floats richtig funktioniert...
Code: [AUSKLAPPEN] Type expl Field milli Field mitX Field mitY Field w Field explosion Field aktX# Field aktY# End Type |
||
B3D-Exporter für Cinema4D!(V1.4)
MD2-Exporter für Cinema4D!(final) |
![]() |
Kleiner satan |
![]() Antworten mit Zitat ![]() |
---|---|---|
wurde mir schon im chat geholfen:) | ||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group