c# - Passing An Bbject To A Class By Refrence -
shotmanager = new shotmanager(shottexture, graphics.graphicsdevice.viewport.bounds, ref spaceship, enemyship);
im passing spaceship parameters object class "shotmanager", problem parameters of spaceship fixed , doesnt change, though when im changing example "position" of ship!
here constructor of shotmanager:
public shotmanager(texture2d shottexture, rectangle movementbounds, ref shipclass spaceship, enemymanager enemyship) { // todo: complete member initialization this.shottexture = shottexture; this.movementbounds = movementbounds; this.spaceship = spaceship; this.enemyship = enemyship; }
here used object "spaceship"
{ fireshot( spaceship.position, spaceshipshotvelocity); }
i keep changing position, apparently object not sent refrence, in other words initial values of spaceship sent.
im beginner programmer please dont banish me.
Comments
Post a Comment