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.


oenda

Member Since 05 May 2013
Offline Last Active Oct 29 2014 11:56 AM

Topics I've Started

Character Rotation While Moving

14 May 2014 - 09:25 AM

Hi.I use SFML with Box2D.I can't rotate the character sprite like GTA 2.My codes:

 

Update:


    if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
        body->ApplyLinearImpulse(b2Vec2(0,-10 * UNRATIO),body->GetWorldCenter(),true);
    }
    else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
        body->ApplyLinearImpulse(b2Vec2(0,10* UNRATIO),body->GetWorldCenter(),true);
    }

    if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
        body->ApplyLinearImpulse(b2Vec2(-5* UNRATIO,0),body->GetWorldCenter(),true);

    }
    else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
        body->ApplyLinearImpulse(b2Vec2(5* UNRATIO,0),body->GetWorldCenter(),true);



Render:

    b2Transform trans = body->GetTransform();
    animatedSprite.setOrigin(width / 2, height / 2);
    angle = trans.q.GetAngle();
    animatedSprite.setRotation(RADTODEG(angle) );

    animatedSprite.setPosition(body->GetWorldCenter().x * RATIO,body->GetWorldCenter().y * RATIO);

    sf::Time frameTime = frameClock.restart();
    animatedSprite.play(*currentAnimation);
         // update AnimatedSprite
    animatedSprite.update(frameTime);

    window.draw(animatedSprite); 

I drew the problem.Can you help me?Thanks.


Terrain or 3d model with physics?

03 March 2014 - 05:37 AM

Hi.I want to know that how game developers create a 3d world?For example Skyim.Are they using terrain algorithms and create a terrain?Or they create a 3d model with 3ds Max/Blender then add physics?I am waiting for your reply smile.png

 


Texture problem on a 3d model

24 December 2013 - 01:23 PM

This is very strange error.I have an ms3d(milkshape 3d) model.I am rendering it but it doesnt appear correctly.It is covered by repeated white textures.
 
I load textures with sfml.My texture loading code:
 

bool CImage::Load(char * szFilename, bool bMipMap)
{
	m_bMipMap = bMipMap;
	m_szFilename = szFilename;

    sf::Image img_data;
    img_data.loadFromFile(m_szFilename);

    m_uiWidth = img_data.getSize().x;
	m_uiHeight = img_data.getSize().y;


    m_uiImage = 0;

	glGenTextures(1, &m_uiImage);
	glBindTexture(GL_TEXTURE_2D, m_uiImage);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

	if(m_bMipMap)
	{
		gluBuild2DMipmaps(GL_TEXTURE_2D, 3, m_uiWidth, m_uiHeight, GL_RGB, GL_UNSIGNED_BYTE,  img_data.getPixelsPtr());
	}
	else
	{
		glTexImage2D(GL_TEXTURE_2D, 0, 3, m_uiWidth, m_uiHeight, 0, GL_RGB, GL_UNSIGNED_BYTE,  img_data.getPixelsPtr());
	}

	return true;
}

 

Any help will be appreciated.


FPS camera - objects problem

18 July 2013 - 06:19 PM

I develop a fps game.I attached gun to camera.But i can't put gun to front of objects.In first picture everything is normal.But in the second picture gun is rendering at back.I can scale objects.If i scale objects , i need to raise zfar value.Will the game use more memory if i do that?What can i do otherwise?

 


Change player color

19 May 2013 - 05:38 AM

Hi.I am developing a 2D strategy game like AoE 2.I need to change player color on sprites.How can i do that?

Thanks.


PARTNERS