|
|
| Allegro functions for jumping a character |
|
zelda007
Member #12,303
October 2010
|
Hi, Based on these sprites : I would like to make my character jumping For the directions RIGHT and LEFT, I use rotate_sprite function and is works If there any Allegro function to inclined a sprite ? Is there another solution . Thanks |
|
jmasterx
Member #11,410
October 2009
|
allegro is intended to be low level graphics routines. If you want to jump, you have to do it yourself. Like, bool isJumping; If you want inclined jumping you have to calculate the nornal of your incline (the slope) then find the perpendicular vector and make a unit vector. Then add a multiple of it to the position to jump higher Explique ton problem en francais j'vais meux comprend. Agui GUI API -> https://github.com/jmasterx/Agui |
|
zelda007
Member #12,303
October 2010
|
In French : jmasterx said: If you want inclined jumping you have to calculate the nornal of your incline (the slope) then find the perpendicular vector and make a unit vector. Then add a multiple of it to the position to jump higher
Pouvez vous m'expliquer en français ? If you want to understand my problem, please watch this video : Thanks |
|
jmasterx
Member #11,410
October 2009
|
Ah ok, la j'comprend mieux. Agui GUI API -> https://github.com/jmasterx/Agui |
|
zelda007
Member #12,303
October 2010
|
J'utilise allegro 4.2.3 donc je n'ai pas ces fonctions... |
|
Trumgottist
Member #95
April 2000
|
If this is a private conversation, maybe you should take it to e-mail? If not… well, my French isn't good enough to follow you, so could you please stick with English? Thanks. -- Play my game: Frasse and the Peas of Kejick |
|
Evert
Member #794
November 2000
|
Trumgottist said: If not… well, my French isn't good enough to follow you,
Then this is a great opportunity to learn, isn't it? In seriousness though: I think it's fine and great to help people who have difficulty with English in their native language. But please do provide an English translation, both for the benefit of people who don't speak the language and to help them improve their English. |
|
zelda007
Member #12,303
October 2010
|
Oh I'm sorry, you are right ! jmasterx said:
Ah ok, la j'comprend mieux.
Oki. I understand. zelda007 said:
J'utilise allegro 4.2.3 donc je n'ai pas ces fonctions...
I use allegro 4.2.3 so I haven't al_XXX functions. You can watch this video to understand my problem : Sorry for our private replies Any ideas ? Thanks |
|
jmasterx
Member #11,410
October 2009
|
rotate_sprite should in fact work similarly to al_draw_rotated_sprite so you can just substitute parameters that I discussed to get the same result Dx, Dy, -> destination point al_draw_rotated_bitmap(bmp, void rotate_sprite(buffer, bmp, Dx, Dy, fixed angle); Shouldn't that work? It is supposed to rotate it around its center so you are only responsible for finding Dx Dy which you should do by using a vector to simulate physics and force for example: a simple triangle would yield
*(200,100, angle = Pi / 4)
*(0,200, angle = 0) *(400,200,angle = 0)
Agui GUI API -> https://github.com/jmasterx/Agui |
|
zelda007
Member #12,303
October 2010
|
Euh, I haven't any cx, cy parameters but maybe this function is appropriate : Quote:
void pivot_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int cx, int cy, fixed angle); But I don't know how to use it... Have you got any example ? |
|
jmasterx
Member #11,410
October 2009
|
You do not need Cx and Cy for rotate sprite because it already rotates around the center of the bitmap, whereas pivot sprite and al_draw_rotated_bitmap are more flexable and allow for a custom center. Agui GUI API -> https://github.com/jmasterx/Agui |
|
|