Godot Nature of Code  1.2.0
Nature of Code implemented in Godot Engine
Public Member Functions | Properties | List of all members
Physics.SimpleBall Class Reference

Simple physics ball. More...

Inherits RigidBody2D.

Inherited by Examples.Chapter5.C5Exercise7.Wheel.

Public Member Functions

 SimpleBall ()
 Create a default ball. More...
 

Properties

Color BaseColor [get, set]
 Base color More...
 
float Radius [get, set]
 Ball radius More...
 

Detailed Description

Simple physics ball.

Definition at line 12 of file SimpleBall.cs.

Constructor & Destructor Documentation

◆ SimpleBall()

Physics.SimpleBall.SimpleBall ( )
inline

Create a default ball.

Definition at line 42 of file SimpleBall.cs.

43  {
44  Mass = 0.25f;
45  circleShape2D = new CircleShape2D() { Radius = 10 };
46  collisionShape2D = new CollisionShape2D() { Shape = circleShape2D };
47 
48  sprite = new SimpleCircleSprite()
49  {
50  Radius = 10,
51  Modulate = Colors.LightBlue
52  };
53  }
Use this to draw a circle. Instead of DrawCircle, it can be batched.
float Radius
Ball radius
Definition: SimpleBall.cs:26

Property Documentation

◆ BaseColor

Color Physics.SimpleBall.BaseColor
getset

Base color

Definition at line 15 of file SimpleBall.cs.

16  {
17  get => sprite.Modulate;
18  set
19  {
20  sprite.Modulate = value;
21  }
22  }

◆ Radius

float Physics.SimpleBall.Radius
getset

Ball radius

Definition at line 25 of file SimpleBall.cs.

26  {
27  get => circleShape2D.Radius;
28  set
29  {
30  sprite.Radius = value;
31  circleShape2D.Radius = value;
32  }
33  }
float Radius
Circle radius.

The documentation for this class was generated from the following file: