Filter löschen
Filter löschen

Need help with a game board piece interacting with the side of the board

3 Ansichten (letzte 30 Tage)
my board piece will be dropping down the board and for every space it moves down there is a chance it will hit a peg. each peg will have a random integer value witch will cause it to move left or right x positions for every space it moves down, the problem is I don't know how to implement a part of the script to reverse the movement of the piece after it collides with the wall (edge of the matrix/board) Thanks in advance
  3 Kommentare
Star Strider
Star Strider am 12 Mär. 2014
Bearbeitet: Star Strider am 12 Mär. 2014
Some background is in this earlier post I could use help with a few parts of a project.
With all the other deflectors, the piece has a probability of moving + (right) or - (left) with a given velocity. If it encounters the left wall, it can only move right, and with the right wall it can only move left. If the ‘board’ is an M row (depth) by N column (width) matrix, then it seems to me that you need to test to see if a given trajectory will result in a column position either <=1 or >=N, reset the position to 1 or N and compute the new velocity and displacement, similarly to any other deflector. You have to take into account the number of positions the piece will move after having hit the previous deflector, determine how many positions it had to move to reach the wall, and have it reflect the remaining distance left (for the right wall) or right (for the left wall).
I didn’t see what the properties of the walls were. This might be important if the position has it stopping at a wall (column position =1 or =N), which seems to me to be possible. What energy does the wall give it in that situation?
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh am 12 Mär. 2014
I don't get a lot of clues from your explanation unfortunately, the most complex game I made was to aim with mouse while you had to read a number appeared for a glimpse somewhere on the screen. I just had to take care of the number not to overlap the bullseye or any of them getting out of the boundaries of the figure, then figure out whether the player clicked on the bullseye and if yes ask them to enter the disappeared number, easy, just testing your attention, lol! I would like to help you with this, but I don't really get what do you want to do! Share your files if you want and I'll do my best to help.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Conway's Game of Life finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by