๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ“ Development Study/๐Ÿ–ผ GameProgramming 2D

Animation Event

by eazuooz 2023. 3. 2.

์˜ˆ์ œ :)

https://github.com/eazuooz/YamYamEngine/commit/9dcd7d665c14f92fad3f35e3beb488681e774f09

 

Animation Event system · eazuooz/YamYamEngine@9dcd7d6

Show file tree Showing 7 changed files with 65 additions and 18 deletions.

github.com

Event๋Š” ๊ฐ๊ฐ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์ฒ˜์Œ ์žฌ์ƒ๋ ๋–„ StartEvent

ํ•˜๋‚˜์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋™์ž‘์ด ์™„๋ฃŒ๋ ๋–„ CompleteEvent

์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์ „ํ™˜๋˜๋ฉด์„œ ๋๋‚ ๋•Œ EndEventํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœ๋˜๊ฒŒ ๋˜์–ด์žˆ๋‹ค.

 

๊ทธ๋ž˜์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด Event์— ์•Œ๋งž๋Š” ๋ฉค๋ฒ„ํ•จ์ˆ˜๋ฅผ bind์‹œ์ผœ์ฃผ์–ด์•ผ ์ œ๋Œ€๋กœ ๋™์ž‘ํ•˜๊ฒŒ ๋œ๋‹ค.

		Image* pImage
			= Resources::Load<Image>(L"PlayerImage", L"..\\Resources\\Images\\link.bmp");
		Animator* animator = GetComponent<Animator>();
		animator->CreateAnimaiton(L"Walk_Up", pImage, Vector2(0.f, 780.f), Vector2(120.f, 130.f), Vector2(0.f, -30.f), 120.f, 10, 0.1f);
		animator->CreateAnimaiton(L"Walk_Down", pImage, Vector2(0.f, 520.f), Vector2(120.f, 130.f), Vector2(0.f, -30.f), 120.f, 10, 0.1f);
		animator->CreateAnimaiton(L"Walk_Left", pImage, Vector2(0.f, 650.f), Vector2(120.f, 130.f), Vector2(0.f, -30.f), 120.f, 10, 0.1f);
		animator->CreateAnimaiton(L"Walk_Right", pImage, Vector2(0.f, 910.f), Vector2(120.f, 130.f), Vector2(0.f, -30.f), 120.f, 10, 0.1f);

		animator->mStartEvent = std::bind(&Player::AnimationStart, this);
		animator->mCompleteEvent = std::bind(&Player::AnimationComplete, this);
		animator->mEndEvent = std::bind(&Player::AnimationEnd, this);

		animator->Play(L"Walk_Down", true);

ํ•ด๋‹น Event๋“ค์€ ์—ฌ๋Ÿฌ๋ถ„๋“ค์˜ ํŽธ๋ฆฌ์„ฑ์„ ์œ„ํ•ด ์ œ๊ณตํ•œ๊ฒƒ์ด๋‹ค.

 

๊ฐ๊ฐ์˜ Event๊ฐ€ ํ˜ธ์ถœ๋˜๋Š” ์ˆœ์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ˜ธ์ถœ๋œ๋‹ค๊ณ  ๋ณด๋ฉด ๋œ๋‹ค.

'๐Ÿ“ Development Study > ๐Ÿ–ผ GameProgramming 2D' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Compute Shader  (0) 2023.04.08
2D Light  (0) 2023.04.08
Animator, Animation2D  (0) 2023.03.02
Collision check / OBB  (0) 2023.03.02
Grid ์˜ค๋ธŒ์ ํŠธ  (0) 2023.03.02

๋Œ“๊ธ€