why the bullet not hit full at the object body?

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 626 Views - Last Post: 06 February 2012 - 10:07 AM

Topic Sponsor:

#16 ShadowsEdge19  Icon User is offline

  • D.I.C Addict


Reputation: 140
  • View blog
  • Posts: 660
  • Joined: 16-January 10

Re: why the bullet not hit full at the object body?

Posted 05 February 2012 - 11:32 AM

You've not sent the correct variable types into the Fly() constructor:

This is what is received in the Fly class:
public fly(Game1 game, Texture2D flytexture, Vector2 posisi, int arah):base(game)
{
...
}


This is what you've sent from Balloon:

fly ballon = [i][b]new fly((Game1)Game, this, ((Game1)Game).flytextures);

Was This Post Helpful? 0
  • +
  • -

#17 hardyyanto  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 17
  • Joined: 12-December 08

Re: why the bullet not hit full at the object body?

Posted 05 February 2012 - 11:56 AM

View PostShadowsEdge19, on 05 February 2012 - 11:32 AM, said:

You've not sent the correct variable types into the Fly() constructor:

This is what is received in the Fly class:
public fly(Game1 game, Texture2D flytexture, Vector2 posisi, int arah):base(game)
{
...
}


This is what you've sent from Balloon:

fly ballon = [i][b]new fly((Game1)Game, this, ((Game1)Game).flytextures);

i am to confusion.. want to get ballon position data from game1.cs page..
because i want to declare the bullet colided with ballon in the fly.cs page, not in game1.cs page..
fly[1] is ballon..
how to get that fly[1] position from fly.cs page?
thx..
Was This Post Helpful? 0
  • +
  • -

#18 hardyyanto  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 17
  • Joined: 12-December 08

Re: why the bullet not hit full at the object body?

Posted 06 February 2012 - 10:07 AM

for making retangle at the bullet and ballon in the fly.cs page, i must passing their parameter from game1.cs page..
in the game1.cs have code:
public readonly static int numfly = 2; 
        public readonly static string[] flytexturepaths = new string[] { "fly", "balon" }; 
        public readonly static Vector2[] flyinitpos = new Vector2[] { new Vector2(50, 250), new Vector2(700, 300) }; 
 
        public Texture2D[] flytextures; 
        public fly[] flys; 
        public SpriteFont arialfont; 
        private int i; 
 
 protected override void LoadContent() 
        { 
            //bullet 
            pelurutexture = Content.Load<Texture2D>("bullet"); 
            //laser 
            lasertexture = Content.Load<Texture2D>("laser"); 
            arialfont = Content.Load<SpriteFont>("Arial"); 
            //arial font 
 
            //---------------------load background----------------- 
            flytextures = new Texture2D[numfly]; 
            for (i = 0; i < numfly; i++) 
            { 
                flytextures[i] = Content.Load<Texture2D>(flytexturepaths[i]); 
            } 
            flys = new fly[numfly]; 
            for (i = 0; i < numfly; i++) 
            { 
                flys[i] = new fly(this, flytextures[i], flyinitpos[i], i); 
                Components.Add(flys[i]); 
            } 
 
            // Create a new SpriteBatch, which can be used to draw textures. 
            spriteBatch = new SpriteBatch(GraphicsDevice); 
            bgtexture = Content.Load<Texture2D>("BG"); 
            // TODO: use this.Content to load your game content here 
        } 

so i want to passing that fly[1] from game1.cs to fly.cs page..
fly[0] is fly
fly[1] is ballon

how to passing the fly[1] parameter to fly.cs page?
thx
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2