c# - Near-identical code causes errors? -
so have 2 lines of extremely similar code. here first line (which has no problems):
player.tex = content.load<texture2d>(@"textures\d");
and here sec line (which has typeinitializationexception)
healthpickup.tex = content.load<texture2d>(@"textures\healthpickup");
in player class , healthpickup class there line after public class this:
public static texture2d tex;
so why healthpickup class causing error? have missed obvious? have tried searching exception nil helps.
edit: requested, healthpickup class follows:
http://pastebin.com/rxz2xh1e
also, player class:
http://pastebin.com/xkuvxpk3
notice healthpickup class identical player class apart 4 variables, (tex, dir, pos , speed in player , tex, randx, randy, pos in healthpickup)
you trying convert object of type random
integer. not allowed. can random number random
object using 1 of next
method overloads. :
(new random (guid.newguid().gethashcode())).next()
using guid.newguid()...
not obligatory, create sure 2 random
objects different seeds
c# xna xna-4.0
No comments:
Post a Comment