Skip to content

Commit 3ec4711

Browse files
authored
Correct 5_adding_basic_code.md
cast `PlayerIndex.One` as int so it compiles. Also correct differences between example code in block and explanation.
1 parent 0a7b299 commit 3ec4711

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

articles/getting_started/5_adding_basic_code.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Find the `Update` method in the Game1.cs class file and add:
164164
```csharp
165165
if(Joystick.LastConnectedIndex == 0)
166166
{
167-
JoystickState jstate = Joystick.GetState(PlayerIndex.One);
167+
JoystickState jstate = Joystick.GetState((int) PlayerIndex.One);
168168

169169
float updatedBallSpeed = ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
170170

@@ -202,10 +202,10 @@ If there is no controller, the code inside the if statement will be skipped over
202202
### Get the current state of Joystick 1
203203

204204
```csharp
205-
JoystickState jstate = Joystick.GetState(0);
205+
JoystickState jstate = Joystick.GetState((int) PlayerIndex.One);
206206
```
207207

208-
This code fetches the current first joystick state `Joystick.GetState(0)` and stores it into a variable called `jstate`.
208+
This code fetches the current first joystick state `Joystick.GetState((int) PlayerIndex.One)` and stores it into a variable called `jstate`.
209209

210210
### CHeck the current value of "Axis" 2
211211

0 commit comments

Comments
 (0)