edub13 Posted May 5, 2016 at 11:53 PM Report #596069 Posted May 5, 2016 at 11:53 PM Boas pessoal, estou a desenvolver um jogo onde quero aplicar o dia e a noite e queria que o sol fizesse o seguinte movimento : Estou a usar Monogame com C#, como posso alcançar isto ? Cumprimentos. Learning: C++
Solution ribeiro55 Posted May 6, 2016 at 10:19 AM Solution Report #596075 Posted May 6, 2016 at 10:19 AM Trigonometria. Podes calcular a posição do sol em função de um ângulo. Se considerares que 0 graus é o teu sol da esquerda, 90 o sol de cima e 180 o sol da direita: float dist_sol = 500f; //o que fizer sentido no teu mundo float ang_sol = 45f; sol.x = centro.x + Math.Cos(ang_sol * (Math.PI/180))*dist_sol sol.y = centro.y + Math.Sin(ang_sol * (Math.PI/180))*dist_sol 45 graus será uma posição a meio caminho do sol da esquerda e do sol de cima, a descrever um círculo. Se aumentares o ang_sol, a posição do sol vai andando a descrever um círculo por aí fora. O "centro" é o centro do teu mundo. O "sol" é o centro do teu sol. Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips"
edub13 Posted May 9, 2016 at 12:59 AM Author Report #596178 Posted May 9, 2016 at 12:59 AM Já consegui, obrigado pela resposta ! Learning: C++
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now