User Tools

Site Tools


events:getting_started_with_godot_in_3d_part_2

This is an old revision of the document!


Notes for everyone

  • on the player object, add raycast to camera
  • enable it
  • set cast to to -100 on Z axis (y=0)
  • create a new node, call it weapon
  • map a new input map “primary_fire” mouse button
  • add a script to weapon (default empty)
  • set up some variables for the weapon, track ammo code
export var fire_rate = 0.5
export var clip_size = 5
export var reload_rate = 1

var current_ammo = clip_size
var can_fire = true

func _process(delta):
  if Input.is_action_just_pressed("primary_fire") and can_fire:
    print "Fired weapon"
events/getting_started_with_godot_in_3d_part_2.1585674355.txt.gz · Last modified: 2020/03/31 18:05 by admin