ammo & music

Blitz3D Forums/Blitz3D Beginners Area/ammo & music

Grey(Posted 2004) [#1]
iv been workin on this game where ur this spaceship and u go around blowing up aliens. Unfortunately, i hav no idea how to get the ammo to move once 'shot', and i cant get the collisions to activate, i tried putting in the bullet type in the collision thingy:
"Collisions playerbullet,ufo,1,1"
but it dusnt work: it keeps saying entity not found so obviously i need 2 do sumthing else. what?

Also, i hav no idea how to get music to work- iv tried a few things but nothing seems to work, and the music on the Wing Ring game doesnt work either, (if its supposed 2) so wats up with that?


Rook Zimbabwe(Posted 2004) [#2]
You could post some source code using this: [~codebox] ...code goes here... [~/codebox] and then people who know (probably not me) can see and help you.

Don't use the ~ thingees I used them so the site wouldn't think I was putting code.

It sounds to me like you haven't told the bullets to move on a path from whence they have been shot and then checked for collision of the object intended.

-RZ


WolRon(Posted 2004) [#3]
BE MORE SPECIFIC


Grey(Posted 2004) [#4]



and




and



is how i got the bullets to exist, but iv only had b3d 4 a few weeks so i dont no how to make them move (il stik 2 that 4 now)


sswift(Posted 2004) [#5]
There are a lot of ways ot make your bullets move.

The simplest way is to do the following:
Point your bullet in the direction you want it to go, and then use moveentity to move it in a positive Z direction.

The Z axis, when in object space, not world space, which is what you are in when using moveentity, is the axis which points in the direction your object is facing, assuming you pointed the mesh in the right direction when you created it.

If you use the above code, then you would do this to make all your bullets move:

[code
BulletSpeed# = 1.0
For Bullet.Playerbullet = Each Playerbullet
MoveEntity p1\entity, 0, 0, BulletSpeed#
Next
[/code]

Also in that loop you would check to see if the bullet has collided with anyhting. And if it has, you would delete the bullet, and then decrement the health of the object that was hit. Or destroy it. You would also play an explosion noise, and display an explosion. Which itself might be animated with a for loop looking at all explosions that you have created and animating them until they reach their last frame and then doing FreeEntity ThisExplosion\Entity and Delete ThisExplosion.

Even better would be if you calculate dhow many seconds a frame took to render (less than 1 in most cases) and then multiplied your bullet's speed by that. So the bullet speed would be how far the bullet moves in a second, and the "deltaseconds#" would modify that so the bullet only moves 1/10th that distance if you are running at 10 frames per second. This is how you make your game run at the same speed on every system. Or you can use frame tweening, like in the castle demo, but personally I find frame tweening to be overly complicated and I don't use it myself. The only real advantage of it is you can play back demos and if you're doing really advanced stuff it might get you a few extra FPS, or make your physics a little more stable, or help with network play. But I have done physics and network play without it. Using it makes a lot of stuff a real pain to do.


eBusiness(Posted 2004) [#6]
I think the most important thing to tell you is that EntityType has nothing to do with types, it's only for collisions.


Ross C(Posted 2004) [#7]
Try not to parent the bullets either. Just set them to the ships rotation and give them the ships current speed. Then add to the speed when the bullet is launched.


gpete(Posted 2004) [#8]
for background sound try this...use your own wav file of course!!! :

sndMusicLoop=LoadSound("windy.wav")
LoopSound sndMusicLoop
PlaySound sndMusicLoop