make tank shoot projectil cuboit and play sound on tank shoot

This commit is contained in:
DS-Minetest 2016-12-04 10:56:23 +01:00
parent ddc29d705c
commit 954c976bed
9 changed files with 19 additions and 4 deletions

View File

@ -13,4 +13,6 @@ This Mod is very WIP.
![alt screenshot] (https://raw.githubusercontent.com/DS-Minetest/mvehicles/master/screenshot.png)
**licenses:** look into [license.txt](https://github.com/DS-Minetest/mvehicles/blob/master/license.txt)
[![licensebutton](http://dev.minetest.net/skins/common/images/cc-by-sa.png)](https://creativecommons.org/licenses/by-sa/3.0/) [![licensebutton](http://i.creativecommons.org/l/by/3.0/88x31.png)](https://creativecommons.org/licenses/by/3.0/) [![licensebutton](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/)
[![licensebutton](http://dev.minetest.net/skins/common/images/cc-by-sa.png)](https://creativecommons.org/licenses/by-sa/3.0/)
[![licensebutton](http://i.creativecommons.org/l/by/3.0/88x31.png)](https://creativecommons.org/licenses/by/3.0/)
[![licensebutton](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/)

Binary file not shown.

View File

@ -15,15 +15,20 @@ minetest.register_entity(
collide_with_objects = true,
weight = 5,
collisionbox = {-0.1,-0.1,-0.1, 0.1,0.1,0.1},
visual ="sprite", --"cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem",
visual_size = {x=0.5, y=0.5},
textures = {"heart.png"},
visual ="mesh", --"cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem",
visual_size = {x=5, y=5},
mesh = "mvehicles_tank_shoot.b3d",
textures = {"mvehicles_tank_shoot.png"},
colors = {},
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
automatic_face_movement_dir = 90.0,
-- ^ automatically set yaw to movement direction; offset in degrees; false to disable
automatic_face_movement_max_rotation_per_sec = -1,
-- ^ limit automatic rotation to this value in degrees per second. values < 0 no limit
on_activate = function(self, staticdata)
if staticdata ~= "" then
@ -63,6 +68,9 @@ minetest.register_entity(
end
end
local rot = -math.deg(math.atan(self.object:getvelocity().y/(self.object:getvelocity().x^2+self.object:getvelocity().z^2)^0.5))
self.object:set_animation({x=rot+90, y=rot+90}, 0, 0)
self.oldpos = self.object:getpos()
self.oldvel = self.object:getvelocity()
self.oldacc = self.object:getacceleration()
@ -451,6 +459,11 @@ minetest.register_entity(
z=(math.sin(self.cannon_direction_horizontal + math.rad(90)))*((math.sin(math.rad(-self.cannon_direction_vertical)))*self.shooting_range)
})
)
minetest.sound_play("mvehicles_tank_shoot", {
pos = self.object:getpos(),
gain = 0.5,
max_hear_distance = 32, -- default, uses an euclidean metric
})
self.shootable = false
minetest.after(

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B