-
Total de itens
2 -
Registro em
-
Última visita
Sobre Bean Dragon
Bean Dragon's Achievements
0
Reputação
-
Bean Dragon alterou sua foto pessoal
-
Já consegui resolver o problema galera. Só acho que os programadores brasileiros são muito desunidos. Os posts daqui quase nunca são respondidos. Eu só consigo resposta em forum internacional. Espero que possamos ajudar mais um ao outro.
-
Ola galera. Eu iniciei uma engine, feita em cima de sdl2. A engine esta fluindo bem em termos gerais.... Porém tem algo me encafifando. Eu criei uma função pra traçar a rota de um objeto.. a object_route. Eu recolho as coordenadas de destino através das coordenadas do mouse no momento do click. O personagem começa a movimentação e muitas vezes termina o trajeto perfeitamente.... mas algumas vezes ele simplesmente para antes de chegar no destino. :/ Alguém poderia me ajudar a entender se existe algum erro de lógica no meu código... Muito obrigado... E aqui esta o código: STATUS object_route(PLACE * to,OBJECT * object,int x,int y){ if(to==NULL||to->map==NULL||object==NULL)return(Off); if(object->x==x&&object->y>y){ object->where = NORTH; object->y -= object->y_speed; if(object->y<=y){ object->where = NOWHERE; object->y = y; return(On); } } else if(object->x==x&&object->y<y){ object->where = SOUTH; object->y += object->y_speed; if(object->y>=y){ object->where = NOWHERE; object->y = y; return(On); } } else if(object->x<x&&object->y==y){ object->where = EAST; object->x += object->x_speed; if(object->x>=x){ object->where = NOWHERE; object->x = x; return(On); } } else if(object->x>x&&object->y==y){ object->where = WEST; object->x -= object->x_speed; if(object->x<=x){ object->where = NOWHERE; object->x = x; return(On); } } else { if(object->x>x&&object->y>y){ object->where = NORTHWEST; object->x -= object->x_speed; object->y -= object->y_speed; if(object->x<=x&&object->y<=y){ object->where = NOWHERE; object->x = x; object->y = y; return(On); } if(object->x<=x){object->x = x;} if(object->y<=y){object->y = y;} } else if(object->x<x&&object->y>y){ object->where = NORTHEAST; object->x += object->x_speed; object->y -= object->y_speed; if(object->x>=x&&object->y<=y){ object->where = NOWHERE; object->x = x; object->x = y; return(On); } if(object->x>=x){object->x = x;} if(object->y<=y){object->y = y;} } else if(object->x<x&&object->y<y){ object->where = SOUTHEAST; object->x += object->x_speed; object->y += object->y_speed; if(object->x>=x&&object->y>=y){ object->where = NOWHERE; object->x = x; object->y = y; return(On); } if(object->x>=x){object->x = x;} if(object->y>=y){object->y = y;} } else if(object->x>x&&object->y<y){ object->where = SOUTHWEST; object->x -= object->x_speed; object->y += object->y_speed; if(object->x<=x&&object->y>=y){ object->where = NOWHERE; object->x = x; object->y = y; return(On); } if(object->x<=x){object->x = x;} if(object->y>=y){object->y = y;} } } if(object->x==x&&object->y==y){ object->where = NOWHERE; return(On); } return(Off); }