xna-4.0


'Microsoft.Xna.Framework.Vector2' is a 'type' but is used like a variable?


Right, I've looked it up on Google and I still can't figure out how to fix it. Any help?
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D spritesheet;
Rectangle sourceRect;
Rectangle destinationRect;
int spriteWidth = 50;
int spriteHeight = 50;
Texture2D maze;
Vector2 mazePosition = Vector2(0f, 0f);
Color[] spritetextureData;
Color[] mazeTextureData;
int direction = 0;
bool persotHit = false;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here
base.Initialize();
}
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
// TODO: use this.Content to load your game content here
}
/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// all content.
/// </summary>
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
// TODO: Add your update logic here
base.Update(gameTime);
}
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
}
}
}
This is how you create new objects:
Vector2 mazePosition = new Vector2(0f, 0f);
and not:
Vector2 mazePosition = Vector2(0f, 0f);
Note the word "new".

Related Links

Griddy2D Making all tiles into a single Texture 2D object
Why my primitives are drawn on top of each other instead inside each other?
XNA 4.0 Spritbatch - render target must not be set on the device
Health Bar in XNA
Xact Visual Studio 2013
XNA 3D object is view as Correctly
Creating RenderTarget2D on runtime makes my screen flash in purple
Having FPS lags when drawing tiles in XNA
Basic Primitive - TriangleStrip - Monogame
XNA 4.0: terrain glitches caused by SpriteBatch
XNA 4.0 contentloadexception was unhandled
XNA 4 VertexPositionTexture triangleStrip sporadically disappearing
Simple way of getting BoundingBox?
XNA Sprite collision class partly not working
How do you publish so it works on other computers?
Simple 3D Collision guide please

Categories

HOME
pandas
coq
openmp
openstack
tizen
comparison
include
grep
spagobi
yarn
rdf
jxls
installshield
directx
iggrid
python-unittest
offline
google-cloud-ml
zend-framework3
windows-azure-storage
django-cms
shared-hosting
google-pagespeed
nodatime
dbext
swiftlint
ml
cx-freeze
tokenize
web-sql
language-agnostic
jndi
lcd
filezilla
fluentvalidation
ping
nameservers
pdb
perlin-noise
avcapturesession
bitbucket-pipelines
automake
streamsets
hue
particles.js
galen
estimote
eclipse-gef
wptoolkit
zip4j
rdfs
gabor-filter
darcs
jxcore
lift-json
epson
flow-control
orthogonal
word-vba-mac
medium.com
home-directory
dstu2-fhir
phishing
fody
pcf
merge-conflict-resolution
firebaseui
lua-5.1
sdf
whois
dataview
wapiti
energy
ios8-today-widget
reactive-banana
icu4j
cannon.js
wireshark-dissector
purge
quicklisp
0xdbe
ideamart
createprocessasuser
composite
device-orientation
sorl-thumbnail
offloading
websocket4net
issuu
eol
funcunit
wp-query
kgdb
cloud-connect
multiprocessor
mysqltuner
c18
gridfs
apc
tws
dataservice
jquery-mobile-dialog
javaspaces
regsvr32
netbeans-6.9
pendrive
code-cleanup
assembly-loading
bigcouch
appendto
yui-datatable
fluent-interface
gallio
thunderbird-lightning
nerddinner

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App