June 2018
Beginner to intermediate
298 pages
7h 38m
English
This is the node setup for the bullet:
Use res://assets/laser.png from the assets folder for the texture of the Sprite, and a CapsuleShape2D for the collision shape. You'll have to set the Rotation of the CollisionShape2D to 90 so that it will fit correctly. You should also scale the Sprite down to half size ((0.5, 0.5)).
Add the following script to the Bullet node:
extends Area2Dexport (int) var speedvar velocity = Vector2()func start(pos, dir): position = pos rotation = dir velocity = Vector2(speed, 0).rotated(dir) func _process(delta): position += velocity * delta
Set the exported speed property to 1000.
The VisibilityNotifier2D is a node that can inform ...
Read now
Unlock full access