Creating similar game to google dinosaur game

3 views (last 30 days)
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
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
Lindsay Guerrero
Lindsay Guerrero on 2 Dec 2017
Okay, great thank you! It still doesn't end the game if it hits the corners of the sqaure for some reason. Also, do you have any suggestions for displaying a game score on the figure?

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!