SlideShare a Scribd company logo
GameSalad (Lec. 07)	

Table
Young-min Kang	

Tongmyong University
Basics
• table
• matrix shaped 2D data
• can be accessed with row and column indices
• all items in a column should be of an identical type
• you can create as many tables as you want
• tables are treated as attributes of game
Table creation
• Home > Tables
• click “+” to create as many table as you want
• rename them
Edit your tables
• determine the # of rows and columns
• determine the type of each column
• you can easily increase the number of columns or rows
• you can rearrange the order of the columns and rows
Prepare for table access
• create an actor and place it in the scene
Display table items
• make the actor display an item in the table
Test it
• press preview button and reset the scene
• every time you reset the scene, randomly chosen item
will be displayed
Table modification
• Change Table Value behavior
Table application
table visualization and manipulation
Create a table
• Prepare a table to be displayed and manipulated
Actor to show items
• create an actor named “item viewer”
• double click and add behaviors as follows
nothing specified here
common behavior
• make the actor display table item (common)
• the item is accessed by attributes of the actor (different attributes for each actor instance)
Instancing
• place the actor instances in the scene
add behaviors
• double-click the actor instances to edit their
behaviors differently
specify different values to instances
Background
• add background and test it
Table items are displayed on the actor instances
Table manipulation
• Table items should be accessed with structured
looping method
• loop behavior
• only in ‘pro’ version which costs $299!
• alternative
• inventing your loop with available behaviors
Single for loop
• for(int i=1;i<=4;i++) {
• TB_State[i][1] = TB_State[i][1]+1;
• }
!
• add attributes
• idxI
• idxJ
• use those indices for our for loop
• here, a single for loop is presented
• idxI is used
Test
• press right key to increase all items in the first column
showing images according
to table data
• itemViewer actor
Table Management
Problem of Timers
• Rule+Timer for looping
• when the condition for the rule is no more valid, the timer is immediately
released
• loop can be stopped with unfinished tasks left
• Clever condition manipulation is needed
add an attribute
MoveDirection (text)
to Game
!
add an attribute
bKeyPressed (boolean)
to background actor
Condition management
• when key is pressed
• game.MoveDirection is set
• the loop will not be stopped while game.MoveDirection is not none
Condition management
• when key is released
• prevent loop from being performed again when the key is pressed
looping condition
Going back to “ready” state
Images for table items
• If you want display items with matching images
• import images to your library
• add an attribute “TB data” to the actor “itemViewer”
Nested “for-loop”
• Timer inside a timer?
• quite complex and it doesn’t work…
• Index manipulation
Tasks for each item
nested
loop
simulation
increase your table item (indRow, indCol) here
Test
Puzzle Implementation Example
2048 style dinoPuzzle
Right Move [ ][ ][ c ][ t ]!
!
initialize t <- 4 , c <- 3!
!
while c > 0!
!
case ( v(c) = 0 ) {!
! decrease c!
}!
case ( v(t) = 0 and v(c) != 0 ) {!
! v(t) <- v(c)!
! v(c) <- 0!
! decrease c!
}!
case ( v(t) != 0 and v(c) = v(t) ) {!
! promote v(t)!
! v(c) <- 0!
! decrease t!
! decrease c!
}!
case ( v(t) != 0 and v(c) != v(t) ) {!
! decrease t!
! decrease c!
}
Left Move [ t ][ c ][ ][ ]!
!
initialize t <- 1 , c <- 2!
!
while c < 5!
!
case ( v(c) = 0 ) {!
! increase c!
}!
case ( v(t) = 0 and v(c) != 0 ) {!
! v(t) <- v(c)!
! v(c) <- 0!
! increase c!
}!
case ( v(t) != 0 and v(c) = v(t) ) {!
! promote v(t)!
! v(c) <- 0!
! increase t!
! increase c!
}!
case ( v(t) != 0 and v(c) != v(t) ) {!
! increase t!
! increase c!
}!
Up Move !
!
initialize t <- 1 , r <- 2!
!
while r < 5!
!
case ( v(r) = 0 ) {!
! increase r!
}!
case ( v(t) = 0 and v(r) != 0 ) {!
! v(t) <- v(r)!
! v(r) <- 0!
! increase r!
}!
case ( v(t) != 0 and v(r) = v(t) ) {!
! promote v(t)!
! v(r) <- 0!
! increase t!
! increase r!
}!
case ( v(t) != 0 and v(r) != v(t) ) {!
! increase t!
! increase r!
}!
Down Move !
!
initialize t <- 4 , r <- 3!
!
while r > 0 !
!
case ( v(r) = 0 ) {!
! decrease r!
}!
case ( v(t) = 0 and v(r) != 0 ) {!
! v(t) <- v(r)!
! v(r) <- 0!
! decrease r!
}!
case ( v(t) != 0 and v(r) = v(t) ) {!
! promote v(t)!
! v(r) <- 0!
! decrease t!
! decrease r!
}!
case ( v(t) != 0 and v(r) != v(t) ) {!
! decrease t!
! decrease r!
}
if you program it, it would look like this
keyboard input
keyboard release
Right Move
next slide
Timer Loop for Right Move
next slide
Move Items
More cases inside
more case
yet more case
test
items moved and merged after ‘right’ key pressed
39

More Related Content

Viewers also liked

фотоконкурс пошук
фотоконкурс пошукфотоконкурс пошук
фотоконкурс пошукksuha12
 
Evaluation 2 powerpoint
Evaluation 2 powerpointEvaluation 2 powerpoint
Evaluation 2 powerpointemmanuella_mmj
 
статут пошук
статут пошукстатут пошук
статут пошукksuha12
 
Rm issue oct 07
Rm issue oct 07Rm issue oct 07
Rm issue oct 07Paul Lai
 
Safety Rocks Campaign Proposal
Safety Rocks Campaign ProposalSafety Rocks Campaign Proposal
Safety Rocks Campaign Proposal
iTours 360VR
 
Mortgage industry explained-maria arrua
Mortgage industry explained-maria arruaMortgage industry explained-maria arrua
Mortgage industry explained-maria arruaMaria A. Arrua
 
Mirjana Gomilanović INTERVJU PR Portal
Mirjana Gomilanović INTERVJU PR PortalMirjana Gomilanović INTERVJU PR Portal
Mirjana Gomilanović INTERVJU PR Portal
AgencijaOne2Grow
 
TriMed Annual Memberships
TriMed Annual MembershipsTriMed Annual Memberships
TriMed Annual Memberships
TriMed : Dr. ESK CIMS Pvt. Ltd
 
Scheduling Algorithms
Scheduling AlgorithmsScheduling Algorithms
Scheduling Algorithms
Sepehr Aliakbary
 
DiVal Events - Creative Marketing Assets and Event Aesthetics
DiVal Events - Creative Marketing Assets and Event AestheticsDiVal Events - Creative Marketing Assets and Event Aesthetics
DiVal Events - Creative Marketing Assets and Event Aesthetics
iTours 360VR
 
Mirjana gomilanovic Wannabe intervju
Mirjana gomilanovic  Wannabe intervjuMirjana gomilanovic  Wannabe intervju
Mirjana gomilanovic Wannabe intervju
AgencijaOne2Grow
 
Avoid six mistakes-maria arrua
Avoid six mistakes-maria arruaAvoid six mistakes-maria arrua
Avoid six mistakes-maria arruaMaria A. Arrua
 
Which loan is best for you maria arrua
Which loan is best for you maria arruaWhich loan is best for you maria arrua
Which loan is best for you maria arruaMaria A. Arrua
 

Viewers also liked (14)

фотоконкурс пошук
фотоконкурс пошукфотоконкурс пошук
фотоконкурс пошук
 
Evaluation 2 powerpoint
Evaluation 2 powerpointEvaluation 2 powerpoint
Evaluation 2 powerpoint
 
статут пошук
статут пошукстатут пошук
статут пошук
 
Rm issue oct 07
Rm issue oct 07Rm issue oct 07
Rm issue oct 07
 
Safety Rocks Campaign Proposal
Safety Rocks Campaign ProposalSafety Rocks Campaign Proposal
Safety Rocks Campaign Proposal
 
Mortgage industry explained-maria arrua
Mortgage industry explained-maria arruaMortgage industry explained-maria arrua
Mortgage industry explained-maria arrua
 
Mirjana Gomilanović INTERVJU PR Portal
Mirjana Gomilanović INTERVJU PR PortalMirjana Gomilanović INTERVJU PR Portal
Mirjana Gomilanović INTERVJU PR Portal
 
TriMed Annual Memberships
TriMed Annual MembershipsTriMed Annual Memberships
TriMed Annual Memberships
 
Scheduling Algorithms
Scheduling AlgorithmsScheduling Algorithms
Scheduling Algorithms
 
DiVal Events - Creative Marketing Assets and Event Aesthetics
DiVal Events - Creative Marketing Assets and Event AestheticsDiVal Events - Creative Marketing Assets and Event Aesthetics
DiVal Events - Creative Marketing Assets and Event Aesthetics
 
Aardappelplantbak final
Aardappelplantbak finalAardappelplantbak final
Aardappelplantbak final
 
Mirjana gomilanovic Wannabe intervju
Mirjana gomilanovic  Wannabe intervjuMirjana gomilanovic  Wannabe intervju
Mirjana gomilanovic Wannabe intervju
 
Avoid six mistakes-maria arrua
Avoid six mistakes-maria arruaAvoid six mistakes-maria arrua
Avoid six mistakes-maria arrua
 
Which loan is best for you maria arrua
Which loan is best for you maria arruaWhich loan is best for you maria arrua
Which loan is best for you maria arrua
 

More from Young-Min kang

[update] Introductory Parts of the Book "Dive into Deep Learning"
[update] Introductory Parts of the Book "Dive into Deep Learning"[update] Introductory Parts of the Book "Dive into Deep Learning"
[update] Introductory Parts of the Book "Dive into Deep Learning"
Young-Min kang
 
Fast CCL(connected component labeling) with GPU
Fast CCL(connected component labeling) with GPUFast CCL(connected component labeling) with GPU
Fast CCL(connected component labeling) with GPU
Young-Min kang
 
인공지능과 딥러닝에 대한 소개
인공지능과 딥러닝에 대한 소개인공지능과 딥러닝에 대한 소개
인공지능과 딥러닝에 대한 소개
Young-Min kang
 
Quaternion and Rotation
Quaternion and RotationQuaternion and Rotation
Quaternion and Rotation
Young-Min kang
 
게임수학 강의노트 1부
게임수학 강의노트 1부게임수학 강의노트 1부
게임수학 강의노트 1부
Young-Min kang
 
물리기반 모델링 기초 - 강의노트
물리기반 모델링 기초 - 강의노트물리기반 모델링 기초 - 강의노트
물리기반 모델링 기초 - 강의노트
Young-Min kang
 
Lec gp05 rigidbody2d
Lec gp05 rigidbody2dLec gp05 rigidbody2d
Lec gp05 rigidbody2d
Young-Min kang
 
Physics for Game: Part1 - Basics
Physics for Game: Part1 - BasicsPhysics for Game: Part1 - Basics
Physics for Game: Part1 - Basics
Young-Min kang
 
Algorithms summary (English version)
Algorithms summary (English version)Algorithms summary (English version)
Algorithms summary (English version)
Young-Min kang
 
Algorithms summary korean
Algorithms summary koreanAlgorithms summary korean
Algorithms summary korean
Young-Min kang
 
Game Physics Test
Game Physics TestGame Physics Test
Game Physics Test
Young-Min kang
 

More from Young-Min kang (11)

[update] Introductory Parts of the Book "Dive into Deep Learning"
[update] Introductory Parts of the Book "Dive into Deep Learning"[update] Introductory Parts of the Book "Dive into Deep Learning"
[update] Introductory Parts of the Book "Dive into Deep Learning"
 
Fast CCL(connected component labeling) with GPU
Fast CCL(connected component labeling) with GPUFast CCL(connected component labeling) with GPU
Fast CCL(connected component labeling) with GPU
 
인공지능과 딥러닝에 대한 소개
인공지능과 딥러닝에 대한 소개인공지능과 딥러닝에 대한 소개
인공지능과 딥러닝에 대한 소개
 
Quaternion and Rotation
Quaternion and RotationQuaternion and Rotation
Quaternion and Rotation
 
게임수학 강의노트 1부
게임수학 강의노트 1부게임수학 강의노트 1부
게임수학 강의노트 1부
 
물리기반 모델링 기초 - 강의노트
물리기반 모델링 기초 - 강의노트물리기반 모델링 기초 - 강의노트
물리기반 모델링 기초 - 강의노트
 
Lec gp05 rigidbody2d
Lec gp05 rigidbody2dLec gp05 rigidbody2d
Lec gp05 rigidbody2d
 
Physics for Game: Part1 - Basics
Physics for Game: Part1 - BasicsPhysics for Game: Part1 - Basics
Physics for Game: Part1 - Basics
 
Algorithms summary (English version)
Algorithms summary (English version)Algorithms summary (English version)
Algorithms summary (English version)
 
Algorithms summary korean
Algorithms summary koreanAlgorithms summary korean
Algorithms summary korean
 
Game Physics Test
Game Physics TestGame Physics Test
Game Physics Test
 

Recently uploaded

240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf
Madhura TBRC
 
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles onlineTreasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Hidden Treasure Hunts
 
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdfMaximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Xtreame HDTV
 
Hollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest galleryHollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest gallery
Zsolt Nemeth
 
The Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy DirectorThe Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy Director
Mark Murphy Director
 
Scandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.zaScandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.za
Isaac More
 
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog EternalMeet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
Blog Eternal
 
A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024
Indira Srivatsa
 
Tom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive AnalysisTom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive Analysis
greendigital
 
Reimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a SuccessReimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a Success
Mark Murphy Director
 
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to StardomYoung Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
greendigital
 
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and LoveMeet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
get joys
 
This Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I MadeThis Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I Made
Aarush Ghate
 
Panchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdfPanchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdf
Suleman Rana
 
Christina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptxChristina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptx
madeline604788
 
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdfCreate a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Genny Knight
 
I Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledgeI Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledge
Sabrina Ricci
 
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
Rodney Thomas Jr
 
Skeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on ForumSkeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on Forum
Isaac More
 

Recently uploaded (19)

240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf
 
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles onlineTreasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
 
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdfMaximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
 
Hollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest galleryHollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest gallery
 
The Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy DirectorThe Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy Director
 
Scandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.zaScandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.za
 
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog EternalMeet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
 
A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024
 
Tom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive AnalysisTom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive Analysis
 
Reimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a SuccessReimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a Success
 
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to StardomYoung Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
 
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and LoveMeet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
 
This Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I MadeThis Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I Made
 
Panchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdfPanchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdf
 
Christina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptxChristina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptx
 
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdfCreate a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
 
I Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledgeI Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledge
 
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
 
Skeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on ForumSkeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on Forum
 

Game salad 07

  • 1. GameSalad (Lec. 07) Table Young-min Kang Tongmyong University
  • 2. Basics • table • matrix shaped 2D data • can be accessed with row and column indices • all items in a column should be of an identical type • you can create as many tables as you want • tables are treated as attributes of game
  • 3. Table creation • Home > Tables • click “+” to create as many table as you want • rename them
  • 4. Edit your tables • determine the # of rows and columns • determine the type of each column • you can easily increase the number of columns or rows • you can rearrange the order of the columns and rows
  • 5. Prepare for table access • create an actor and place it in the scene
  • 6. Display table items • make the actor display an item in the table
  • 7. Test it • press preview button and reset the scene • every time you reset the scene, randomly chosen item will be displayed
  • 8. Table modification • Change Table Value behavior
  • 10. Create a table • Prepare a table to be displayed and manipulated
  • 11. Actor to show items • create an actor named “item viewer” • double click and add behaviors as follows nothing specified here
  • 12. common behavior • make the actor display table item (common) • the item is accessed by attributes of the actor (different attributes for each actor instance)
  • 13. Instancing • place the actor instances in the scene
  • 14. add behaviors • double-click the actor instances to edit their behaviors differently specify different values to instances
  • 15. Background • add background and test it Table items are displayed on the actor instances
  • 16. Table manipulation • Table items should be accessed with structured looping method • loop behavior • only in ‘pro’ version which costs $299! • alternative • inventing your loop with available behaviors
  • 17. Single for loop • for(int i=1;i<=4;i++) { • TB_State[i][1] = TB_State[i][1]+1; • } ! • add attributes • idxI • idxJ • use those indices for our for loop • here, a single for loop is presented • idxI is used
  • 18. Test • press right key to increase all items in the first column
  • 19. showing images according to table data • itemViewer actor
  • 21. Problem of Timers • Rule+Timer for looping • when the condition for the rule is no more valid, the timer is immediately released • loop can be stopped with unfinished tasks left • Clever condition manipulation is needed add an attribute MoveDirection (text) to Game ! add an attribute bKeyPressed (boolean) to background actor
  • 22. Condition management • when key is pressed • game.MoveDirection is set • the loop will not be stopped while game.MoveDirection is not none
  • 23. Condition management • when key is released • prevent loop from being performed again when the key is pressed
  • 25. Going back to “ready” state
  • 26. Images for table items • If you want display items with matching images • import images to your library • add an attribute “TB data” to the actor “itemViewer”
  • 27. Nested “for-loop” • Timer inside a timer? • quite complex and it doesn’t work… • Index manipulation
  • 28. Tasks for each item nested loop simulation increase your table item (indRow, indCol) here
  • 29. Test
  • 31. 2048 style dinoPuzzle Right Move [ ][ ][ c ][ t ]! ! initialize t <- 4 , c <- 3! ! while c > 0! ! case ( v(c) = 0 ) {! ! decrease c! }! case ( v(t) = 0 and v(c) != 0 ) {! ! v(t) <- v(c)! ! v(c) <- 0! ! decrease c! }! case ( v(t) != 0 and v(c) = v(t) ) {! ! promote v(t)! ! v(c) <- 0! ! decrease t! ! decrease c! }! case ( v(t) != 0 and v(c) != v(t) ) {! ! decrease t! ! decrease c! } Left Move [ t ][ c ][ ][ ]! ! initialize t <- 1 , c <- 2! ! while c < 5! ! case ( v(c) = 0 ) {! ! increase c! }! case ( v(t) = 0 and v(c) != 0 ) {! ! v(t) <- v(c)! ! v(c) <- 0! ! increase c! }! case ( v(t) != 0 and v(c) = v(t) ) {! ! promote v(t)! ! v(c) <- 0! ! increase t! ! increase c! }! case ( v(t) != 0 and v(c) != v(t) ) {! ! increase t! ! increase c! }! Up Move ! ! initialize t <- 1 , r <- 2! ! while r < 5! ! case ( v(r) = 0 ) {! ! increase r! }! case ( v(t) = 0 and v(r) != 0 ) {! ! v(t) <- v(r)! ! v(r) <- 0! ! increase r! }! case ( v(t) != 0 and v(r) = v(t) ) {! ! promote v(t)! ! v(r) <- 0! ! increase t! ! increase r! }! case ( v(t) != 0 and v(r) != v(t) ) {! ! increase t! ! increase r! }! Down Move ! ! initialize t <- 4 , r <- 3! ! while r > 0 ! ! case ( v(r) = 0 ) {! ! decrease r! }! case ( v(t) = 0 and v(r) != 0 ) {! ! v(t) <- v(r)! ! v(r) <- 0! ! decrease r! }! case ( v(t) != 0 and v(r) = v(t) ) {! ! promote v(t)! ! v(r) <- 0! ! decrease t! ! decrease r! }! case ( v(t) != 0 and v(r) != v(t) ) {! ! decrease t! ! decrease r! } if you program it, it would look like this
  • 35. Timer Loop for Right Move next slide
  • 39. test items moved and merged after ‘right’ key pressed 39