Jump to content

  • Log In with Google      Sign In   
  • Create Account


kingpinzs

Member Since 23 Aug 2002
Offline Last Active May 28 2014 10:21 AM
-----

Topics I've Started

python collision recursion issue

18 May 2014 - 12:22 AM

    def touching(self, bubble, bubbles):
        for bubble1 in bubbles:
            bubble_old = bubble1
            if self.color == bubble_old.color and dist(bubble.pos, bubble_old.pos) <= 2 * BUBBLE_RADIUS:
                bubbles.remove(bubble_old)
                self.touching(bubble1, bubbles)
 
 
The error occurs when there are two rows right next to each that need to be removed.

for example like this
x x  x  x  x
x O O O x
x x  O O x
x x  O  x x
       O <-current ball

Traceback (most recent call last):
  File "main.py", line 140, in draw
    if a_bubble.remove_matching(stuck_bubbles):
  File "main.py", line 72, in remove_matching
    self.touching(bubble_old, bubbles)
  File "main.py", line 81, in touching
    self.touching(bubble1, bubbles)
  File "main.py", line 80, in touching
    bubbles.remove(bubble_old)
KeyError: <__main__.Bubble instance at 0x192c878>

 


How do I use a class object as a parameter?

02 June 2013 - 10:07 PM

How does one go about passing a class object as a parameter in another class's method.

 

e.g.

class Player
{
Monster monster;
bool attack(Monster& monster);
}
 
class Monster
{
//do stuff
 
}

 

 


issue with image placement in respect of another image

10 May 2012 - 02:05 PM

I am using XNA 4.0 and c#

how can I get an image to set its position according to the end of another image?

this is what I have so far


                rocketPosition = players.Position;
                rocketPosition.X += players.Position.X +40;
                rocketPosition.Y -= players.Position.Y -370 ;
                rocketAngle = players.Angle;
                Vector2 up = new Vector2(0, -1);
                Matrix rotMatrix = Matrix.CreateRotationZ(rocketAngle);
                rocketDirection = Vector2.Transform(up, rotMatrix);
                rocketDirection *= players.Power / 50.0f;

the rocket goes in the right direction but its starting position is wrong if I move the cannon

the code that moves the cannon

if (keybState.IsKeyDown(Keys.Left))
            {
                if(players.Angle > MathHelper.PiOver4-.3)
                players.Angle -= 0.01f;
            }
            if (keybState.IsKeyDown(Keys.Right))
            {
                if (players.Angle < MathHelper.PiOver2)
                players.Angle += 0.01f;
            }

Need help with a array sequence

12 February 2012 - 08:04 PM

This is what I need to do

// void advance( )
// Precondition: is_item returns true.
// Postcondition: If the current item was already the last item in the
// sequence, then there is no longer any current item. Otherwise, the new
// current item is the item immediately after the original current item.

And this is what I did


void sequence::advance( )
{

if(is_item())
{

if(current_index <= used)
{
++current_index;
}
}

but it goes passed the actual array data.


How can I fix that?

I'm using c++

problem loading mesh with trancparent texture

18 August 2011 - 01:02 PM

I am using D3DXLoadMeshFromX and D3DCreateTextureFromFile but it doesnt show transpaerncy with the texture

hw can I acomplish this? I am using directx 9c and c++

PARTNERS