Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualThomas Wiborg

Posted 20 January 2013 - 12:17 PM

Yeah, but what you say, is that Vector2 is better to use than Point in games? Well I fixed it. And here is my new code. Thanks alot for the help guys! Realy amazing community here on gamedev!

 


            if (target.Position.Y < 0)
            {
                Vector2 vv;
                Vector2 vp;
                vv = target.Velocity;
                vv.Y *= -1;
                target.Velocity = vv;
                
                vp = target.Position;
                vp.Y = 0;
                target.Position = vp;            
            }
            else if (target.Position.Y > SCREEN_HEIGHT - target.Origin.Y)
            {
                Vector2 v2v;
                Vector2 v2p;
                v2v = target.Velocity;
                v2v.Y *= -1;
                target.Velocity = v2v;

                v2p = target.Position;
                v2p.Y = SCREEN_HEIGHT - target.Origin.Y;
                target.Position = v2p;      
            }

 


#6Thomas Wiborg

Posted 20 January 2013 - 12:16 PM

Yeah, but what you say, is that Vector2 is better to use than Point in games?

Well I fixed it. And here is my new code. Thanks alot for the help guys! Realy amazing community here on gamedev!


if (target.Position.Y < 0)		    {			    Vector2 vv;			    Vector2 vp;			    vv = target.Velocity;			    vv.Y *= -1;			    target.Velocity = vv;			    			    vp = target.Position;			    vp.Y = 0;			    target.Position = vp;		    		    }		    else if (target.Position.Y > SCREEN_HEIGHT - target.Origin.Y)		    {			    Vector2 v2v;			    Vector2 v2p;			    v2v = target.Velocity;			    v2v.Y *= -1;			    target.Velocity = v2v;			    v2p = target.Position;			    v2p.Y = SCREEN_HEIGHT - target.Origin.Y;			    target.Position = v2p;	  		    }

#5Thomas Wiborg

Posted 20 January 2013 - 12:16 PM

Yeah, but what you say, is that Vector2 is better to use than Point in games?

Well I fixed it. And here is my new code. Thanks alot for the help guys! Realy amazing community here on gamedev!


if (target.Position.Y < 0)		    {			    Vector2 vv;			    Vector2 vp;			    vv = target.Velocity;			    vv.Y *= -1;			    target.Velocity = vv;			    			    vp = target.Position;			    vp.Y = 0;			    target.Position = vp;		    		    }		    else if (target.Position.Y > SCREEN_HEIGHT - target.Origin.Y)		    {			    Vector2 v2v;			    Vector2 v2p;			    v2v = target.Velocity;			    v2v.Y *= -1;			    target.Velocity = v2v;			    v2p = target.Position;			    v2p.Y = SCREEN_HEIGHT - target.Origin.Y;			    target.Position = v2p;	  		    }

#4Thomas Wiborg

Posted 20 January 2013 - 12:16 PM

Yeah, but what you say, is that Vector2 is better to use than Point in games?

Well I fixed it. And here is my new code. Thanks alot for the help guys! Realy amazing community here on gamedev!


if (target.Position.Y < 0)		    {			    Vector2 vv;			    Vector2 vp;			    vv = target.Velocity;			    vv.Y *= -1;			    target.Velocity = vv;			    			    vp = target.Position;			    vp.Y = 0;			    target.Position = vp;		    		    }		    else if (target.Position.Y > SCREEN_HEIGHT - target.Origin.Y)		    {			    Vector2 v2v;			    Vector2 v2p;			    v2v = target.Velocity;			    v2v.Y *= -1;			    target.Velocity = v2v;			    v2p = target.Position;			    v2p.Y = SCREEN_HEIGHT - target.Origin.Y;			    target.Position = v2p;	  		    }

#3Thomas Wiborg

Posted 20 January 2013 - 12:16 PM

Yeah, but what you say, is that Vector2 is better to use than Point in games?

Well I fixed it. And here is my new code. Thanks alot for the help guys! Realy amazing community here on gamedev!


if (target.Position.Y < 0)		    {			    Vector2 vv;			    Vector2 vp;			    vv = target.Velocity;			    vv.Y *= -1;			    target.Velocity = vv;			    			    vp = target.Position;			    vp.Y = 0;			    target.Position = vp;		    		    }		    else if (target.Position.Y > SCREEN_HEIGHT - target.Origin.Y)		    {			    Vector2 v2v;			    Vector2 v2p;			    v2v = target.Velocity;			    v2v.Y *= -1;			    target.Velocity = v2v;			    v2p = target.Position;			    v2p.Y = SCREEN_HEIGHT - target.Origin.Y;			    target.Position = v2p;	  		    }

#2Thomas Wiborg

Posted 20 January 2013 - 12:16 PM

Yeah, but what you say, is that Vector2 is better to use than Point in games?

Well I fixed it. And here is my new code. Thanks alot for the help guys! Realy amazing community here on gamedev!


if (target.Position.Y < 0)		    {			    Vector2 vv;			    Vector2 vp;			    vv = target.Velocity;			    vv.Y *= -1;			    target.Velocity = vv;			    			    vp = target.Position;			    vp.Y = 0;			    target.Position = vp;		    		    }		    else if (target.Position.Y > SCREEN_HEIGHT - target.Origin.Y)		    {			    Vector2 v2v;			    Vector2 v2p;			    v2v = target.Velocity;			    v2v.Y *= -1;			    target.Velocity = v2v;			    v2p = target.Position;			    v2p.Y = SCREEN_HEIGHT - target.Origin.Y;			    target.Position = v2p;	  		    }

PARTNERS