I need some help please. I a designing a game I call city defender, I have the math working now for the Shooting bit, but the drop bomb code is running two fast, here the code!!
;Ok here we will draw Each of the nukes
Function DrawtheNuke()
For dropnuke.defnuke = Each defnuke
If dropnuke\nukemode=1 Then
dropnuke\nukexmod=dropnuke\nukexmod+.6
dropnuke\nukeymod=dropnuke\nukeymod+.6
Color 255,255,255
Line dropnuke\snukexmod,dropnuke\snukeymod,dropnuke\nukexmod,dropnuke\nukeymod
DrawImage dropnuke\gfxs2,dropnuke\nukexmod,dropnuke\nukeymod
ElseIf dropnuke\nukemode=2 Then
dropnuke\nukexmod=dropnuke\nukexmod-.6
dropnuke\nukeymod=dropnuke\nukeymod+ .6
Color 255,255,255
Line dropnuke\snukexmod,dropnuke\snukeymod,dropnuke\nukexmod,dropnuke\nukeymod
DrawImage dropnuke\gfxs2,dropnuke\nukexmod,dropnuke\nukeymod
End If
Next
;Ok here check to sea if the Nuke if off the screen!!!
For dropnuke.defnuke = Each defnuke
If dropnuke\nukemode=1 Then
If dropnuke\nukexmod >800 Or dropnuke\nukeymod>600 Then
Delete dropnuke
End If
ElseIf dropnuke\nukemode=2 Then
If dropnuke\nukexmod <1 Or dropnuke\nukeymod>600 Then
Delete dropnuke
End If
End If
Next
End Function
Can any one suggest a way to slow this down a bit as the bomb and the builits are always missing each other..
Here is the Bulit move code
Function movedbullet()
For playerbullet.defbullet = Each defbullet
If playerbullet\mouselockx#<=419 Then
theta#=ATan2(playerbullet\mouselocky# - playerbullet\by# ,playerbullet\bx# - playerbullet\mouselockx#)
dx#=Cos(theta#)
dy#=Sin(theta#)
playerbullet\bx#=playerbullet\bx# -dx#
ElseIf playerbullet\mouselockx#>=420 Then
theta#=ATan2(playerbullet\mouselocky# - playerbullet\by# ,playerbullet\mouselockx# - playerbullet\bx# )
dx#=Cos(theta#)
dy#=Sin(theta#)
playerbullet\bx#=playerbullet\bx# + dx#
End If
playerbullet\by#=playerbullet\by# + dy#
;Ok check To sea if the termainate point has been reached!!
;Terminate
If Int(playerbullet\bx#) = Int(playerbullet\mouselockx#) Then
If Int(playerbullet\by#) = Int(playerbullet\mouselocky#) Then
If playerbullet\Terminate=0 Then
playerbullet\Terminate=1
playerbullet\nukex=10
playerbullet\nukey=10
End If
End If
End If
Next
End Function
If any one can sugest a way to speed upone or slow the other down it be a great help.. I keep looking for the answer bye my self but I rewriten the routeans a cople of times and they seam still to be to qick or two slow.
TA
Darren (tokra)
;Ok here we will draw Each of the nukes
Function DrawtheNuke()
For dropnuke.defnuke = Each defnuke
If dropnuke\nukemode=1 Then
dropnuke\nukexmod=dropnuke\nukexmod+.6
dropnuke\nukeymod=dropnuke\nukeymod+.6
Color 255,255,255
Line dropnuke\snukexmod,dropnuke\snukeymod,dropnuke\nukexmod,dropnuke\nukeymod
DrawImage dropnuke\gfxs2,dropnuke\nukexmod,dropnuke\nukeymod
ElseIf dropnuke\nukemode=2 Then
dropnuke\nukexmod=dropnuke\nukexmod-.6
dropnuke\nukeymod=dropnuke\nukeymod+ .6
Color 255,255,255
Line dropnuke\snukexmod,dropnuke\snukeymod,dropnuke\nukexmod,dropnuke\nukeymod
DrawImage dropnuke\gfxs2,dropnuke\nukexmod,dropnuke\nukeymod
End If
Next
;Ok here check to sea if the Nuke if off the screen!!!
For dropnuke.defnuke = Each defnuke
If dropnuke\nukemode=1 Then
If dropnuke\nukexmod >800 Or dropnuke\nukeymod>600 Then
Delete dropnuke
End If
ElseIf dropnuke\nukemode=2 Then
If dropnuke\nukexmod <1 Or dropnuke\nukeymod>600 Then
Delete dropnuke
End If
End If
Next
End Function
Can any one suggest a way to slow this down a bit as the bomb and the builits are always missing each other..
Here is the Bulit move code
Function movedbullet()
For playerbullet.defbullet = Each defbullet
If playerbullet\mouselockx#<=419 Then
theta#=ATan2(playerbullet\mouselocky# - playerbullet\by# ,playerbullet\bx# - playerbullet\mouselockx#)
dx#=Cos(theta#)
dy#=Sin(theta#)
playerbullet\bx#=playerbullet\bx# -dx#
ElseIf playerbullet\mouselockx#>=420 Then
theta#=ATan2(playerbullet\mouselocky# - playerbullet\by# ,playerbullet\mouselockx# - playerbullet\bx# )
dx#=Cos(theta#)
dy#=Sin(theta#)
playerbullet\bx#=playerbullet\bx# + dx#
End If
playerbullet\by#=playerbullet\by# + dy#
;Ok check To sea if the termainate point has been reached!!
;Terminate
If Int(playerbullet\bx#) = Int(playerbullet\mouselockx#) Then
If Int(playerbullet\by#) = Int(playerbullet\mouselocky#) Then
If playerbullet\Terminate=0 Then
playerbullet\Terminate=1
playerbullet\nukex=10
playerbullet\nukey=10
End If
End If
End If
Next
End Function
If any one can sugest a way to speed upone or slow the other down it be a great help.. I keep looking for the answer bye my self but I rewriten the routeans a cople of times and they seam still to be to qick or two slow.
TA
Darren (tokra)