• Create Account

# ElDuro

Member Since 28 Jan 2013
Offline Last Active Jul 06 2015 09:25 PM

### In Topic: watercyfle

14 April 2014 - 04:54 AM

edit: i had my laugh now let me try to help.

where exactly are you having problems? what is it that you understand and what don't you understand? do you know what you need to do? do you get the idea? No one is going to do your assignment for you, no matter how many times you say please. But if you have any questions then this is the right place.

### In Topic: Could someone explain this?

18 March 2014 - 06:08 PM

I like to say char * a_pointer;

You can also declare it as int main(int argc char **argv);

http://stackoverflow.com/questions/3898021/mainint-argc-char-argv

### In Topic: Vitrual touchscreen joystick

07 August 2013 - 03:05 PM

Are there any 2d games on touch screen devices with a good joystick (or dpad) implementation? I haven't found a good reference for this, so I have researching physical joysticks and what this comes down to is called a "restrictor gate". (see link under "8-way")

http://www.slagcoin.com/joystick/restrictors.html

Now I want to test the same concept, except within an octagon.

So to clamp a point within a rectangle:

if(point.x < throwRect.getMinX())
point.x = throwRect.getMinX();
if(point.x > throwRect.getMaxX())
point.x = throwRect.getMaxX();
if(point.y < throwRect.getMinY())
point.y = throwRect.getMinY();
if(point.y > throwRect.getMaxY())
point.y = throwRect.getMaxY();

To clamp a point within a circle:

if(distance > throwDistance)
{
point.x = stickCenter.x + cos(angle) * throwDistance;
point.y = stickCenter.y + sin(angle) * throwDistance;
}

How can I clamp a point within an octagon? Thank you

### In Topic: Implementing beams for space shooter

23 July 2013 - 04:12 PM

Thanks a trillion. I implemented the beam as a long animated texture that gets "cropped" based on a ray cast. If the ray cast intersects with a fixture then it renders a explosion sprite on top of it. The green projectiles are simply bullets shot at a fast speed as said earlier. However, the orbs (the white things that shoot the green projectiles) get their position from the player's position some x frames before.

Some pseudocode:

const int delay = 10;

//orbPosition is playerPosition at ten frames before player's currentPosition

VectorClass pastPositions [delay];

//update index once per frame

int index = 0;

orbPosition = pastPositions[index] + offset;

pastPositions[index] = currentPlayerPosition;

### In Topic: Vitrual touchscreen joystick

02 July 2013 - 07:35 PM

Thanks. I was going to leave it as is. I just wanted to see if there was some programming trick that could be used.

PARTNERS