ID:150121
 
I can not get my shoot to work i want it so it plays a sound as well as shooting in a stright line at any time instead of firing only when a enemy is there and not all the time. If you have played tanks like that.Could some one plz help me.

Unix
Create an object that based on the direction of the weapon moves itself in that direction. This should get you started:
obj
  bullet
    New(dir)
      walk(src,dir,3)
    Bump(atom/A)
      // Damage check here

mob
  verb
    fire()
      new/obj/bullet(get_step(src,src.dir))

You should of course test more things in the fire() verb, but I think this is a good start.


/Andreas
In response to Gazoot
Still need help so ive put somet on to it like this
usr.hp -= 10

but how do i add a sound or make it so it shows up a icon??
In response to Unix
obj
bullet
New(dir)
walk(src,dir,3)
Bump(atom/A)
// Damage check here
usr.hp -= 10
icon = 'shoot.dmi'
icon_state = "moving"


mob
verb
Fire()
new/obj/bullet(get_step(src,src.dir))

ive doen this so far but i dont realy get it

<font color=yellow>Unix (bit of a n00b)
In response to Unix
Some one help me
In response to Unix
Unix wrote:
obj
bullet
New(dir)
walk(src,dir,3)
Bump(atom/A)
// Damage check here
usr.hp -= 10
icon = 'shoot.dmi'
icon_state = "moving"

ive doen this so far but i dont realy get it

Ahem, bumping posts is not nice, so please don't do that.

Does the example work? I see that you have usr.hp -= 10, but the Bump proc supplies an atom A as the bumped object. So you need to test if A is a mob, and then subtract 10 hitpoints from A.
Also, the icon and icon_state shouldn't be in the Bump proc. You can put it on top like all other objects.


/Andreas