gamelogic

45

Upload: juhong-jeong

Post on 17-Nov-2014

500 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Gamelogic
Page 2: Gamelogic
Page 3: Gamelogic
Page 4: Gamelogic

How can make this?

Page 5: Gamelogic

Programming Language!

Page 6: Gamelogic

Code

• printf(“Hello World”);

Page 7: Gamelogic

Code

• DrawImage( img, x, y );

Page 8: Gamelogic
Page 9: Gamelogic

Important Logic

• Game loop• Change screen• Collision detection• Status check

Page 10: Gamelogic

What is computer?

• Fast calculator

Page 11: Gamelogic

Game loop

Page 12: Gamelogic

Game loop

• It’s all of the game loop logic

Page 13: Gamelogic

Game loop

Page 14: Gamelogic
Page 15: Gamelogic

Game loop

Page 16: Gamelogic

Game loop

Page 17: Gamelogic

Game loop

Page 18: Gamelogic

Change screen

Page 19: Gamelogic

Change screen

• Simple code

Page 20: Gamelogic

Change screen

Page 21: Gamelogic

Change screen

Page 22: Gamelogic

Change screen

Page 23: Gamelogic

Change screen

Page 24: Gamelogic

Change screen

Page 25: Gamelogic

Change screen

• How can change screen?

Page 26: Gamelogic

Notice!

• Do not write code like this.• This code is not stable.• Just for showing example.

Page 27: Gamelogic

Collision detection

Page 28: Gamelogic

Collision detection

• Why check collision?

Page 29: Gamelogic

Collision detection

• Computer don’t know anything• Just have data

Page 30: Gamelogic

Collision detection

• Remember mathematics!

Page 31: Gamelogic

Collision detection

• Circle collision detection

Page 32: Gamelogic

Collision detection

• Rectangle collision detection

Page 33: Gamelogic

Collision detection

• Rectangle collision detection

boolean rectangle_collision(float x_1, float y_1, float width_1, float height_1, float x_2, float y_2, float width_2, float height_2)

{return !(x_1 > x_2+width_2 || x_1+width_1 < x_2 ||

y_1 > y_2+height_2 || y_1+height_1 < y_2);}

Page 34: Gamelogic

Collision detection

• How about button?

Page 35: Gamelogic

Collision detection

• But how about it?

Page 36: Gamelogic

Collision detection

• But how about it?

Page 37: Gamelogic

Status check

Page 38: Gamelogic

Status check

• Player is dead?

Page 39: Gamelogic

Status check

• I want to buy weapon!

Page 40: Gamelogic

Status check

• Do I have money?

Page 41: Gamelogic

Status check

• Drinking potion!

Page 42: Gamelogic

Status check

• Drinking potion!

Page 43: Gamelogic

What do you think about it?

Page 44: Gamelogic

Q n A

Page 45: Gamelogic