Creating similar game to google dinosaur game
3 views (last 30 days)
Show older comments
Hi, I was looking for some help to figure out how to stop my gaming function when the moving object hits the obstacle, like in the google dinosaur function and to show a running score on my figure for the high score. Anyone know some helpful tips to code this?
5 Comments
Walter Roberson
on 2 Dec 2017
Remember, the above code is the same as
if all(all((Countrow <80) & (any(Background(400:640,101:180,:)==0,1)),2),3)
closeFunc();
The fragment
any(Background(400:640,101:180,:)==0)
only applies the any() to the first non-scalar dimension, leaving you with a 1 x 80 x something array that the default all() rules apply to
Answers (0)
See Also
Categories
Find more on Google in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!