Skip to main content

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

Great engine, but a few small questions:

- When you shoot straight, the bullets go straight from the center of the screen, but how do you keep them centered when you look up (ztilt)?

- The collision between the walls and the bullets doesn't seem to work...

- What's this script?
collide_3d_circle(parent_enemy)
?!?!?!?????!!!!???? The script is not visible in the script list? It's a ghost script and yet it works ?!? I must have missed something...
Ditto for zcheck_script_bottom: I don't understand...

Thank you !!

Scripts can have multiple tabs, collide_3d_circle is a tab of collide_3d.  zcheck_script_bottom is a variable that's set to different variables for each terrain object, there's no actual script with that name. (Blocks use collide_block_bottom, slopes use the collide_slope_*_bottom family)

I think the collision-checking bug with bullets is because collidecheck() uses place_meeting() to check for collisions, so the bullets need to have a sprite to be able to collide with the terrain.

I think bullets might leave you off-center when shooting upwards/downwards because of the coordinate computation in the ss_pistol / ss_machinegun scripts... right now they're created at 60% off the player's height instead of in their absolute center, but the camera is placed at 80% of the player's height. (I suppose 60% felt like the height you'd have your hands at when holding a gun, if your eyes are at 80%? Or maybe it's just an oversight)

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.