- XNA 4.0 Game Development by Example Beginner's Guide(Visual Basic Edition)
- Kurt Jaegers
- 163字
- 2021-08-20 15:50:43
Time for action – modify Game1 to generate rotating pieces
- Update the
HandleMouseInput()
method in theGame1
class to add rotating pieces to the board by adding the following inside the"if mouseInfo.LeftButton = ButtonState.Pressed"
block, before _gameBoard.RotatePiece()
is called:_gameBoard.AddRotatingPiece(x, y, _gameBoard.GetSquare(x, y), False)
- Still in
HandleMouseInput()
, add the following in the same location inside theif
block for the right-mouse button:_gameBoard.AddRotatingPiece(x, y, _gameBoard.GetSquare(x, y), True)
What just happened?
Recall that the only difference between a clockwise rotation and a counter-clockwise rotation (from the standpoint of the AddRotatingPiece()
method) is a true or false in the final parameter. Depending on which button is clicked, we simply add the current square (before it gets rotated, otherwise the starting point for the animation would be the final position) and true for right-mouse clicks or false for left-mouse clicks.
推薦閱讀
- 數(shù)據(jù)存儲架構(gòu)與技術(shù)
- 數(shù)據(jù)庫基礎(chǔ)與應(yīng)用:Access 2010
- App+軟件+游戲+網(wǎng)站界面設(shè)計教程
- InfluxDB原理與實戰(zhàn)
- Starling Game Development Essentials
- 科研統(tǒng)計思維與方法:SPSS實戰(zhàn)
- HikariCP連接池實戰(zhàn)
- 數(shù)據(jù)庫原理與設(shè)計實驗教程(MySQL版)
- 數(shù)據(jù)分析思維:產(chǎn)品經(jīng)理的成長筆記
- Unity Game Development Blueprints
- 從Lucene到Elasticsearch:全文檢索實戰(zhàn)
- 工業(yè)大數(shù)據(jù)融合體系結(jié)構(gòu)與關(guān)鍵技術(shù)
- 數(shù)據(jù)庫原理及應(yīng)用實驗:基于GaussDB的實現(xiàn)方法
- GameMaker Game Programming with GML
- Applying Math with Python