How to insert an image in a GUI and have it move according to a small moving matrix's location

4 views (last 30 days)
I am creating a code for a class that requires a spaceship to move throughout space (a matrix). We have created randomly spawning asteroids. If the spaceship crashes into an asteroid the game is over. The user can also change the spaceship's speed and direction after every 30 iterations. Currently, our GUI is black with white blocks spawning as asteroids. The spaceship is also a white matrix. We need to input an image where the spaceship matrix moves and an another image where the asteroids appear. I'm stumped on how to do this. Thanks.
  2 Comments
Jan
Jan on 26 Apr 2018
I cannot follow your explanations after the first sentence already: "a code for a class that requires a spaceship to move throughout space (a matrix)". A class requires a spaceship? What is "a matrix"? Later on you mention, that the "matrix is white". How can a rectangular set of numbers have a color? What does "input an image where the spaceship matrix moves" mean?
The current description is far too vague to understand, what you are doing. In addition you forgot to ask a question. How can we help you based on the given information?
Kristen O'Mara
Kristen O'Mara on 26 Apr 2018
The assignment (not the class) asks for a code that moves a spaceship through space. We represented "space" with a matrix of zeros (black). We then created code that randomly generates asteroids which are smaller matrices of ones (hence the white color). We also represented the spaceship with a matrix of ones (white). So currently in our function, the user chooses the size of the spaceship's matrix, the speed, the direction, and the starting x and y positions. These are all inputs of our function. My question is how to impose an image where our matrix that represents our spaceship is. However, this image has to move wherever the matrix that represents the spaceship moves. My other question is how to impose an image over all the randomly generated matrices that represent asteroids. I hope this is more clear. Sorry for the confusion

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!