How to make a cow game piece in matlab

2 views (last 30 days)
Megan Harner
Megan Harner on 9 Nov 2018
Answered: Walter Roberson on 10 Nov 2018
I am currently trying to make a version of connect four but cow themed. I want to make the 'chip' pieces that you drop into the game into cows. I don't mind what the cow looks like I just need to know how to create it.
  1 Comment
Geoff Hayes
Geoff Hayes on 10 Nov 2018
Megan - what are you using to represent the board for the game? Are you using a figure with an axes or are you using an image that you will continuously update with the game pieces? Please provide more details.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 10 Nov 2018
If you use an image then when you call image() you can pass in coordinates to place the image at. For example, assuming you reserve 50 pixels by 50 pixels per piece,
user_row = 17; user_col = 9;
x_base = (user_col - 1) * 50 + 5;
y_base = (user_row - 1) * 50 + 5;
image([x_base x_base+40], [y_base, y_base+40], brown_cow);

Categories

Find more on Just for fun 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!