c# - The name "xxxx" does not exist in the current context -
so i'm creating mario remake using xna (following tutorial go because understanding still limited), , came across error "text"
using system; using system.collections.generic; using system.collections; using system.linq; using system.text; using microsoft.xna.framework; using microsoft.xna.framework.graphics; namespace personalproject.managers { class tilemanager { arraylist mtiles; public tilemanager() { mtiles = new arraylist(); } public void addtile(texture2d tile, vector2 pos) { mtiles.add(new tile(text, pos)); } public void draw(spritebatch spritebatch) { foreach (tile tile in mtiles) { } } } class tile { public texture2d texture; public vector2 position; public tile(texture2d text, vector2 pos) { texture = text; position = pos; } } }
under
mtiles.add(new tile(text, pos));
i'm getting "the name 'text' not exist in current context" though have in
public tile(texture2d text, vector2 pos) { texture = text; position = pos; }
"pos" isn't outputting me errors though, ideas?
the context here next method:
public void addtile(texture2d tile, vector2 pos) { mtiles.add(new tile(text, pos)); }
the text
variable not in scope there.
i guess meant is:
public void addtile(texture2d tile, vector2 pos) { mtiles.add(new tile(tile, pos)); }
or
public void addtile(texture2d text, vector2 pos) { mtiles.add(new tile(text, pos)); }
c# xna
No comments:
Post a Comment