Can't modify XNA Vector components

前端 未结 4 1066
花落未央
花落未央 2020-12-20 16:57

I have a class called Sprite, and ballSprite is an instance of that class. Sprite has a Vector2 property called Position.

I\'m trying to increment the Vector\'s X c

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-20 17:31

    You can do

     Position = new Vector2(Position.X + 1, Position.Y );
    

    or

     Position += new Vector2( 1.0f, 0.0f );
    

    or

     Position.X += 1.0f;
    

提交回复
热议问题