Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Thank you very much for the answer!
The multiple tabs of scripts I didn't know, I'm learning thank you!

For the bullets collision with walls, even putting a sprite it doesn't work (parent_bullet). But by putting code in obj_bullet_pistol it seems to work. To be seen...

Otherwise to make the bullets always centered on the screen according to the ztilt doesn't seem so obvious to me. When the ztilt is at its highest value, ztilt=-90: dividing it by 2 pulls in the middle, unfortunately it doesn't work for the other ztilt values. Anyway, I'm going to look for...

Thanks again!

(+1)

Tabbed scripts is removed in current GMS2, so don't get too used to them, I guess :P (But they will be a thing again once the 2.3 update is released, when you can define "functions" and scripts are changed into source code files)

Yes, that's correct, the different bullet types (pistol, machinegun etc) needs to have the sprite, because those are the objects that actually spawn. The parent just is a container for code / behavior they have in common.

As for making bullets always spawn in the center of the view: go into ss_pistol and ss_machinegun and change the line

n.z = z + cz + zheight*0.6

into

n.z = z + cz + zheight*0.8

and they will now be in sync with the camera.

(+1)

A thousand thanks! Everything's working fine now! (For the bullets, I had put a sprite too small)

(1 edit) (+1)

Sorry, two more things:

- For bullets colliding: OK, but then, if I'm on a wall, it won't shoot... but well, not too hard to correct...

- For the shooting in the middle of the screen, I wanted to say that when you shoot with the titlt at 0, the bullet goes to the middle of the screen, it's OK (imagine that your sight is in the middle of the screen). But if you shoot higher, the bullet doesn't conform to the middle of the screen anymore (it's as if your sight is no longer in the middle of the screen).

I was just making these remarks because it's important for an fps, but the engine is already remarkable!

Make sure you use the 3D collision checking script (so you check the bullet's Z position as well) instead of just a collision event.

I don't think the bullet displacement will be noticeable in-game. Right now the bullets are slow and their projectile model doesn't rotate, so perspective plays some tricks with you. And many types of guns (machine guns, shotguns, grenade launchers, homing projectiles)  won't shoot in a straight line anyway.