FPS and tutorials for using my gun??
Blitz3D Forums/Blitz3D Beginners Area/FPS and tutorials for using my gun??
| ||
I am still learning how to use Blitz 3-d, and I would like to see a tutorial of using guns in an FPS, you know something to show me the ropes in the firing of guns,trajectories, etc. Any help would be appreciated |
| ||
Have you seen my FPS example at my programming tutorial? |
| ||
WolRon's FPS example is an excellent, easy-to-understand, starting point to get your FPS feet wet. |
| ||
I understand most of the code fine, but I am unable to get my bullet to fire from my gun, it doesn't move. I'll show you what I have thus far in my CheckWeapon() Function.. ;my function for firing the gun Function CheckWeapon() If MouseHit(1) shot.bullet = New bullet shot\model = LoadMesh("C:\Documents and Settings\flacka\Desktop\Game\bullet head.3ds") shot\casing = LoadMesh("C:\Documents and Settings\flacka\Desktop\Game\b caseing.3ds") shot\x = EntityX(pistol\model) shot\y = EntityY(pistol\model) shot\z = EntityZ(pistol\model) shot\zv = .5 ScaleEntity shot\model,.01,.01,.01 PositionEntity shot\model,EntityX(pistol\model),EntityY(pistol\model),EntityZ(pistol\model) RotateEntity shot\model,EntityPitch(pistol\model),EntityYaw(pistol\model),EntityRoll(pistol\model) EndIf For shot.bullet = Each bullet MoveEntity shot\model, 0,0,shot\zv If Abs(EntityX(shot\model)) > 10000 FreeEntity shot\model Delete shot ElseIf Abs(EntityY(shot\model)) > 10000 FreeEntity shot\model Delete shot ElseIf Abs(EntityZ(shot\model)) > 10000 FreeEntity shot\model Delete shot EndIf UpdateWorld Next End Function I am trying to get the code in WolRon's Example tutorial, I don't think the idea is sinking in.... Please Help |
| ||
Have you defined your type fields (eg shot\zv) as floating point (# symbol)? If not, then your fractional movements are all zero because your fields are integers, which would explain why they're going nowhere. |
| ||
quote:If MouseHit(1) shot.bullet = New bullet shot\model = LoadMesh("C:\Documents and Settings\flacka\Desktop\Game\bullet head.3ds") shot\casing = LoadMesh("C:\Documents and Settings\flacka\Desktop\Game\b caseing.3ds") outch! You should never ever load things in the main loop. Instead load then at startup, the reuse them. you can also load each thing you are going to use, then use CopyMesh to create a clone on the fly. also make sure your bullets are not parented to anything (eg. to the camera, via gun). So use EntityParent shot\model,0 |
| ||
Sir Gak is probably right about you not using a float for your z velocity. bad, bad, bad: shot\model = LoadMesh("C:\Documents and Settings\flacka\Desktop\Game\bullet head.3ds") shot\casing = LoadMesh("C:\Documents and Settings\flacka\Desktop\Game\b caseing.3ds")good: beginning of program ;bulletmesh = LoadMesh("bullet.b3d") ;load in a bullet mesh (this will be a template mesh) ;do any scaling here as wellin your CheckWeapon function bullet\entityhandle = CopyEntity(bulletmesh) ;create the bullet mesh not ideal: If MouseHit(1)better: in user input section: mouse1 = MouseHit(1)in your CheckWeapon function: If mouse1 unnecessary data: shot\x = EntityX(pistol\model) shot\y = EntityY(pistol\model) shot\z = EntityZ(pistol\model) lastly: What are the forum codes? |