Game Development Community

How i can set player speed when pickup weapon

by Alongkorn · in General Discussion · 02/24/2007 (9:26 am) · 5 replies

How can i set player speed when i pick up weapon. exsample when i pick RPG set speed 5. when i pickup m16 set speed 9 . how can i do?

#1
02/24/2007 (10:12 am)
Take a look at this resource cause in "out of the box " torque speed is set in the datablock which means that it is the same for every player having that datablock at every time. After you intergrated that resource it should be something like adding %player.setSpeed(9); in a method in inventory.cs or weapon.cs.
#2
02/24/2007 (7:24 pm)
How about setMoveSpeed, without the resource? What's the difference?
#3
02/25/2007 (2:50 am)
You will change the speed in the datablock so every player sharing that datablock will have its speed changed in multiplayer. So if you have one player datablock in a muliplayer game, you change the speed in that datablock and every player will have its speed changed (if datablocks changes are even updated to clients). If you are doing a single player game i think its 'okay' to change datablocks, you wont notice problems as long as you use a different datablock for the "main player" then for enemys/friendlys.

While writing this i came up with another solution. You could set the movement speed for weapons in the player datablock and use that when the player picks up a certain weapon (could even be "heavy weapon", "normal weapon", "light weapon"). There are many more solutions which for many people aren't practical and the resource is most dynamic.
#4
02/25/2007 (4:38 am)
You can also give the weapon image a greater mass:
e.g
mass = 90;

this will slow down the player.