I'd suggest doing some programming tutorials. There is almost never a good reason to manipulate a public field this way. Then too, there's a naming issue. What is x
? The horizontal position of the entire window? Some object? Something else entirely? Be as obvious as possible, and it will go well for you.
The actual problem is likely that game is null in update, which seems rather odd. If you REALLY want to do this, I'd suggest modifying Class1.Update
to Class1.Update(Game1 game)
. Then you can do y.Update(this)
.
Still, this is definitely the wrong way to solve the problem. You can do it better. Just be aware of that.