Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Ahmed Egyptian

Member Since 05 Mar 2013
Offline Last Active Nov 29 2013 10:33 AM

Posts I've Made

In Topic: Solving state machine problem for a centipede

28 November 2013 - 11:13 AM

I just don't need to use a tile map, and a basic centipede movement where I can place the nodes (pictures) with an offset between each node. 


In Topic: Solving state machine problem for a centipede

28 November 2013 - 05:07 AM

Thanks for the inputs.
 
I have initialized the nodes as follow. The gab can not be defined here, as whatever happens the node's prev position will be copied anyway. How would I set it ? 

for (var i:int = 0; i < 5; i++)
{
 var sprite:Node = new Node();
 sprite.x = 100 + i * 90;
 sprite.y = 20;
 sprite.vx = -1;
 sprite.vy = 0;
 sprite.previousDirX = -1;
 m_nodes.push(sprite);
 addChild(m_nodes[i]);
}

Regarding the memorization technique, and the collision I have done that, it works but still a lot of flaws.

 

Is the algorithm correct ?

if (m_nodes[0].x > 750)
{
 delayCounter++;

 if (delayCounter == 1)
 {
  m_nodes[0].previousDirX = m_nodes[0].vx;
 }

 m_nodes[0].vx = 0;
 m_nodes[0].vy = 1;

if (delayCounter > 2)
{
 delayCounter = 0;
 trace("prev" + m_nodes[0].previousDirX);
 m_nodes[0].vx = -1 * m_nodes[0].previousDirX; 
 m_nodes[0].vy = 0;
}

 }
}

How did you ident your code that is posted here ? manually ?

 


In Topic: Solving state machine problem for a centipede

27 November 2013 - 03:18 PM

I'm not using any tilemap, why should I use a tile map to let the sections not overlap ? the current problem is they are like this xxxx  instead of  x    x    x   x    x  x 


In Topic: Solving state machine problem for a centipede

27 November 2013 - 01:19 PM

Thank you so much!. will follow all things you mentioned. 

I have another problem, which is setting an offset between the nodes, they are overlapping each other.


In Topic: Solving state machine problem for a centipede

25 November 2013 - 12:50 PM

I debugged it a lot I still can't find where is the problem.  The space between the nodes can not be adjusted correctly relative to the speed and the collision also dismisses at a lot of cases :/


PARTNERS