MATLAB Answers

0

How to make a cow game piece in matlab

Asked by Megan Harner on 9 Nov 2018 at 15:01
Latest activity Answered by Walter Roberson
on 10 Nov 2018 at 21:46
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

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.

1 Answer

Answer by Walter Roberson
on 10 Nov 2018 at 21:46

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);

  0 Comments

Sign in to comment.