<스크립트>

*player.gd
extends KinematicBody2D
func _physics_process(delta):
if Input.is_action_pressed("ui_right"):
$Sprite.flip_h = false
$Sprite.play("Run")
motion.x = lerp(motion.x, 0, 0.2)
motion = move_and_slide(motion, UP)

 

*WorldComplete.gd
extends Area2D
export(String, FILE, ".tscn") var next_world
func _physics_process(delta):
var bodies = get_overlapping_bodies()
for body in bodies:
if body.name == "player2":
get_tree().change_scene(next_world)

 

*************************************************************************************************

<P1, P2: Player>
KinematicBody2D
Sprite
CollisionShape2D

KinematicBody2D
AnimatedSprite
CollisionShape2D
>>Frames - New SpriteFrames 클릭
Sprite Frames 탭에서 애니메이션 설정
Import - Preset - 2D Pixel 선택 후 Reimport 할 것.

 

<P2 : 타일맵>
Node
Sprite
>>Offset-Centerd : off
>>Region-Enavled : on
>>Texture Region 탭
Snap Mode : Grid Snap
Sprite를 배치 후에, Scene - Convert To - TileSet : tres 파일로 저장
씬에 TileMap 배치 Tile Set에 tres 파일 지정

 

<P4 : 레벨 이동>
Area2D
Sprite
CollisionShape2D

*************************************************************************************************

<P6: ParallaxBackground>

www.youtube.com/watch?v=K-eM2ZLI1q8&list=PL9FzW-m48fn2jlBu_0DRh7PvAt-GULEmd&index=6

Project Settings
Rendering - Quality - 2d :: Use Pixel Snap (On)
Camera - Smoothing (Off)

ParallaxBackground
ParallaxLayer
Motion - Mirroring (640, 640)
Motion - Scale (0.1, 0.1)
Sprite
Offset Centerd(off) Offset (0,0)

*************************************************************************************************

<P7 : UI, Signals>

www.youtube.com/watch?v=sBuJRHvk5sY&list=PL9FzW-m48fn2jlBu_0DRh7PvAt-GULEmd&index=7

*UI
Control
CenterContainer
VboxContainer
Label
Button

MarginContainer
CenterContainer
VButtonArray

get_tree().change_scene("")

get_tree().quit()

+ Recent posts