フィルターのクリア

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

3 ビュー (過去 30 日間)
Austin
Austin 2014 年 3 月 12 日
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 件のコメント
Star Strider
Star Strider 2014 年 3 月 12 日
編集済み: Star Strider 2014 年 3 月 12 日
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 2014 年 3 月 12 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeConway's Game of Life についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by