<원인>

  1. 3.1부터 추가된 Typed GDScript 기능으로 인하여 생긴 문제.
  2. 다른 gd 파일(특히 AutoLoad 파일)의 클래스 변수 사용여부를 알 수가 없다.

<해결책>
  1. Project>Project Settings>General>Debug>Gdscript의 Warnings 항목에서 "Unused Class Variable" 비활성화.
  2. Enable을 비활성화하는 것은 디버깅을 하기 위해서는 권장하지 않는다.

<참고>



<Godot2/3 설정>

  1. Settings>Editor Settings>External Editor 선택.
  2. Use External Editor를 On.
  3. Exec Path 설정.(예: C:/Program Files/Microsoft VS Code/Code.exe)
  4. Exec Flags에 {project} --goto {file}:{line}:{col}로 설정.


<VSCode 설정>

  1. 터미널>작업 구성을 선택하여 "탬플릿에서 tasks.json 파일 만들기" 선택.
  2. "Others 임의의 외부 명령을 실행하는 예" 선택.
  3. tasks.json에서 "label"과 "command"를 설정.(예:"label": "run godot2", "type": "shell", "command": "d:\\Godot2\\Godot2.exe d:\\Godot2\\Node.tscn")
  4. 터미널>작업 실행 메뉴에서 소스코드가 제대로 실행되는지 확인.
  5. 추가로 바로 가기 키를 설정하고 싶으면, keybindings.json를 설정하면 된다.(예:"key": "ctrl+G", "command": "workbench.action.tasks.runTasks", "args": "run Godot2")



<참고>

https://www.reddit.com/r/godot/comments/8z6yxu/how_can_i_connect_my_visual_studio_code_to_godot/

Member Functions

Color Color8 ( int r8, int g8, int b8, int a8=255 )
Color ColorN ( String name, float alpha=1.0 )
float abs ( float s )
float acos ( float s )
float asin ( float s )
void assert ( bool condition )
float atan ( float s )
float atan2 ( float x, float y )
Variant bytes2var ( PoolByteArray bytes )
Vector2 cartesian2polar ( float x, float y )
float ceil ( float s )
String char ( int ascii )
float clamp ( float value, float min, float max )
Object convert ( Variant what, int type )
float cos ( float s )
float cosh ( float s )
float db2linear ( float db )
float decimals ( float step )
float dectime ( float value, float amount, float step )
float deg2rad ( float deg )
Object dict2inst ( Dictionary dict )
float ease ( float s, float curve )
float exp ( float s )
float floor ( float s )
float fmod ( float x, float y )
float fposmod ( float x, float y )
Object funcref ( Object instance, String funcname )
int hash ( Variant var )
Dictionary inst2dict ( Object inst )
Object instance_from_id ( int instance_id )
float inverse_lerp ( float from, float to, float weight )
bool is_inf ( float s )
bool is_nan ( float s )
int len ( Variant var )
float lerp ( float from, float to, float weight )
float linear2db ( float nrg )
Object load ( String path )
float log ( float s )
float max ( float a, float b )
float min ( float a, float b )
int nearest_po2 ( int value )
Variant parse_json ( String json )
Vector2 polar2cartesian ( float r, float th )
float pow ( float x, float y )
Resource preload ( String path )
void print ( ) vararg
void print_stack ( )
void printerr ( ) vararg
void printraw ( ) vararg
void prints ( ) vararg
void printt ( ) vararg
float rad2deg ( float rad )
float rand_range ( float from, float to )
Array rand_seed ( int seed )
float randf ( )
int randi ( )
void randomize ( )
Array range ( ) vararg
float range_lerp ( float value, float istart, float istop, float ostart, float ostop )
float round ( float s )
void seed ( int seed )
float sign ( float s )
float sin ( float s )
float sinh ( float s )
float sqrt ( float s )
float stepify ( float s, float step )
String str ( ) vararg
Variant str2var ( String string )
float tan ( float s )
float tanh ( float s )
String to_json ( Variant var )
bool type_exists ( String type )
int typeof ( Variant what )
String validate_json ( String json )
PoolByteArray var2bytes ( Variant var )
String var2str ( Variant var )
Object weakref ( Object obj )
float wrapf ( float value, float min, float max )
int wrapi ( int value, int min, int max )
GDScriptFunctionState yield ( Object object=null, String signal=”” )

Numeric Constants

  • PI = 3.141593 — Constant that represents how many times the diameter of a circle fits around its perimeter.
  • TAU = 6.283185 — The circle constant, the circumference of the unit circle.
  • INF = inf — A positive infinity. (For negative infinity, use -INF).
  • NAN = nan — Macro constant that expands to an expression of type float that represents a NaN.

The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0.

 

1. GDScript 클래스에서 지원하는 메서드 함수 리스트.

2. ColorN() 함수에서 지원하는 컬러이름 목록은 다음과 같다.

“aliceblue”, “antiquewhite”, “aqua”, “aquamarine”, “azure”, “beige”, “bisque”, “black”, “blanchedalmond”, “blue”, “blueviolet”, “brown”, “burlywood”, “cadetblue”, “chartreuse”, “chocolate”, “coral”, “cornflower”, “cornsilk”, “crimson”, “cyan”, “darkblue”, “darkcyan”, “darkgoldenrod”, “darkgray”, “darkgreen”, “darkkhaki”, “darkmagenta”, “darkolivegreen”, “darkorange”, “darkorchid”, “darkred”, “darksalmon”, “darkseagreen”, “darkslateblue”, “darkslategray”, “darkturquoise”, “darkviolet”, “deeppink”, “deepskyblue”, “dimgray”, “dodgerblue”, “firebrick”, “floralwhite”, “forestgreen”, “fuchsia”, “gainsboro”, “ghostwhite”, “gold”, “goldenrod”, “gray”, “webgray”, “green”, “webgreen”, “greenyellow”, “honeydew”, “hotpink”, “indianred”, “indigo”, “ivory”, “khaki”, “lavender”, “lavenderblush”, “lawngreen”, “lemonchiffon”, “lightblue”, “lightcoral”, “lightcyan”, “lightgoldenrod”, “lightgray”, “lightgreen”, “lightpink”, “lightsalmon”, “lightseagreen”, “lightskyblue”, “lightslategray”, “lightsteelblue”, “lightyellow”, “lime”, “limegreen”, “linen”, “magenta”, “maroon”, “webmaroon”, “mediumaquamarine”, “mediumblue”, “mediumorchid”, “mediumpurple”, “mediumseagreen”, “mediumslateblue”, “mediumspringgreen”, “mediumturquoise”, “mediumvioletred”, “midnightblue”, “mintcream”, “mistyrose”, “moccasin”, “navajowhite”, “navyblue”, “oldlace”, “olive”, “olivedrab”, “orange”, “orangered”, “orchid”, “palegoldenrod”, “palegreen”, “paleturquoise”, “palevioletred”, “papayawhip”, “peachpuff”, “peru”, “pink”, “plum”, “powderblue”, “purple”, “webpurple”, “rebeccapurple”, “red”, “rosybrown”, “royalblue”, “saddlebrown”, “salmon”, “sandybrown”, “seagreen”, “seashell”, “sienna”, “silver”, “skyblue”, “slateblue”, “slategray”, “snow”, “springgreen”, “steelblue”, “tan”, “teal”, “thistle”, “tomato”, “turquoise”, “violet”, “wheat”, “white”, “whitesmoke”, “yellow”, “yellowgreen”.

 

<참고>
http://docs.godotengine.org/en/3.0/classes/class_@gdscript.html

1. Process Material에서 New ParticlesMaterial 선택.

2. Textures에서 Texture에 Particle로 사용할 이미지를 선택.

3. Time

  • Lifetime : Particle의 생존시간.
  • One Shot : 활성화를 하면 Amount 만큼 한번만 방출하고, 비활성화를 하면 반복하여 방출.
  • Preprocess : 지정한 시간(초) 이후의 방출 모습부터 표현.
  • Speed Scale : 방출되는 속도. 숫자가 클수록 속도가 빨라짐. 기본값은 1.
  • Explosiveness : 0일 경우(기본값) 일정 간격으로 방출. 1일 경우 동시에 모두 방출. 0~1사이값으로 지정도 가능. 폭발이나 Particle을 급히 만들여야 할 때 유용.
  • Randomness : 모든 물리 파라미터값을 0~1사이의 값으로 랜덤화할 수 있다. 랜덤화하는 공식은 다음과 같다.
    • initial_value = param_value + param_value * randomness
  • Fixed FPS : 랜더링을 고정된 프레임 단위로 함. Particle System의 속도를 늦추는 것은 아님.
  • Fract Delta : Delta time을 이야기하는 건지 뭔지 자세한 설명이 없슴.

4. Drawing

  • Visibility Rect : 폭과 너비, 그리고 위치 설정.
  • Local Coords : 노드에 방출된 Particle의 좌표를 종속시킬 것인지를 결정. 종속된 경우, 노드 이동시 같이 이동함.
  • Draw Order : Particle을 표현하는 순서를 제어. Index(기본값)와 Lifetime가 있는데, 정확하게 차이점이 뭔지 모르겠슴.

5. ParticlesMaterial settings

  • Spread
  • Gravity
  • Initial Velocity : 방출 속도.(Pixel per seconds)
  • Angular Velocity
  • Spin Velocity : Particle 회전 속도.
  • Orbit Velocity
  • Linear Acceleration
  • Radial Acceleration
  • Tangential Acceleration :
  • Damping : Particle에 마찰 적용.
  • Angle : 초기 방출 각도(Degree).
  • Scale : 초기 Particle의 크기.
  • Color : 색상 변경.
  • Hue variation : 색조 변화.

 

<참고>
http://docs.godotengine.org/en/latest/tutorials/2d/particle_systems_2d.html#particlesmaterial-settings

Clamps value and returns a value not less than min and not more than max.

speed = 1000
# a is 20
a = clamp(speed, 1, 20)

speed = -10
# a is 1
a = clamp(speed, 1, 20)

 

  1. 최대, 최소값을 적용해야하는 것들(예: 속도, 가속도, 데미지, 혹은 UI에서 볼륨 설정 등)에 적용할 때 사용하면 유용할 듯 하다.
  2. if문을 사용하지 않아도 되므로 1~2줄의 코드라인을 절약할 수 있다.

 

 

<참고>
http://docs.godotengine.org/en/3.0/classes/class_@gdscript.html?highlight=clamp#class-gdscript-clamp

1. Python에서는 type() 함수를 써서 변수 타입을 알아볼 수 있다. 그와 같은 함수가 typeof() 함수이다.


2. Python의 type() 함수와는 다르게, 변수 타입을 체크하기 위해서 별도의 조건문이나 조건식을 사용해야 한다.

예) print(typeof(a) == TYPE_VECTOR2)


 

<참고>
http://docs.godotengine.org/en/stable/classes/class_@gdscript.html#class-gdscript-typeof

1. 기본적으로는 둘다 delta값에 의해서 동기화를 하는 콜백 함수.

2. 물리엔진을 적용해서 사용해야하는 경우(예:KinematicBody)는 _physics_process() 함수를 써야한다.(RigidBody의 경우는 _integrate_forces()를 사용해야 한다.)

3. Key값은 _process()에서 받고, KinematicBody의 제어는 _physics_process()에서 할 경우, 동기화 문제로 인하여 Jittering이 발생할 수 있으므로, 이런 경우는 Key값도 _physics_process()에서 담당하도록 코딩을 한다.

1. Platform 게임 개발시 아랫층에서 윗층으로 점프할 때 유용하다.

2. 2.x 버젼에서는 One Way Collision을 적용할 방향을 설정할 수 있는 옵션이 인스펙터에 있었는데 현재 3.0.5에서는 없다.(해당 클래스인 CollisionShape2D의 설명을 보면 'Sets whether this collision shape should only detect collision on one side (top or bottom).' 이라고 써있는 걸 보면 간소화 시킨 듯)

3. 2.1.4 버젼에서는 One Way Collisor로 되어 있으며, PhysicsBody2D 3종 세트(StaticBody2D, RigidBody2D, 그리고 KinematicBody2D)에 옵션이 있으며, 3.0.5 버젼에는 CollisionShape2D과 CollisionPolygon2D에 옵션이 있다.

 

<참고>
http://docs.godotengine.org/en/latest/classes/class_collisionshape2d.html
http://docs.godotengine.org/en/latest/classes/class_collisionpolygon2d.html

+ Recent posts