Autor
| Is there any C cross compiler that generates ROM files?
|
Huey msx professional Mensajes: 672 | Publicado: Abril 20 2006, 16:53   |
You just lost me.  |
|
ARTRAG msx master Mensajes: 1802 | Publicado: Abril 20 2006, 16:57   |
|
|
Huey msx professional Mensajes: 672 | Publicado: Abril 20 2006, 17:24   |
That should keep me busy for a while.  |
|
ARTRAG msx master Mensajes: 1802 | Publicado: Abril 20 2006, 17:31   |
FYI my draft table was a Mealy machine, as output
(next action) depends on input (event) and state.
PS
start using type = 0 and define one table at time...
|
|
manuel msx guru Mensajes: 3637 | Publicado: Abril 20 2006, 18:46   |
Note that jumps are not sinus movements, but parabolas (gravity is a force, which causes an acceleration according to Newton). Which are a lot faster and easier to compute  |
|
ARTRAG msx master Mensajes: 1802 | Publicado: Abril 20 2006, 19:06   |
A bugfix
main {
...
if ((kbd & 1)!=0 && feet_on_floor) {dy=4;}
y = y + dy;
if (!feet_on_floor)
{dy = max {-4, dy -1};}
else
{dy = 0;}
...
}
the jump is height
4 + 3 + 2 + 1 = 10 points |
|
Huey msx professional Mensajes: 672 | Publicado: Abril 20 2006, 21:44   |
@manuel: That's what i meant. I dind knew the english name....
@ARTRAG: What library is max in?
|
|
ARTRAG msx master Mensajes: 1802 | Publicado: Abril 20 2006, 21:45   |
Quote:
|
What library is max in?
|
any fantasy lib :-)
try this:
#define max(A,B) ( (A) > (B) ? (A):(B))
@manuel
About falling, my solution approximates very well a parabola,
as the 2nd order derivate is constant and equal to -1
(except for the fact that max speed is limited to -4, in
this case the 2nd order derivate is 0, but can
be interpreted as attrite).
|
|
Huey msx professional Mensajes: 672 | Publicado: Abril 20 2006, 22:23   |
@ARTRAG: fantasy.lib
The jump isn't very high. I'll experiment with it this weekend.
I'm must say it's getting rather mathematical. Thats not my biggest talent  I thought it would be more about 'tricks' than FSM and stuff. But its real interesting. I vagely remember Mealy and sorts during my study but I had some other interests back then  |
|
ARTRAG msx master Mensajes: 1802 | Publicado: Abril 20 2006, 22:36   |
About FSM, do not worry, things are much simpler that they seem
Go ahead and you'll see yourself
About jumping higer, try
main {
...
if ((kbd & 1)!=0 && feet_on_floor) {dy=5;}
y = y + dy;
if (!feet_on_floor)
{dy = max {-5, dy -1};}
else
{dy = 0;}
...
}
this gives
5 + 4 + 3 +2 +1 = 15 points |
|
Huey msx professional Mensajes: 672 | Publicado: Abril 20 2006, 22:48   |
Shouldn't it be: y = y - dy?
|
|
ARTRAG msx master Mensajes: 1802 | Publicado: Abril 20 2006, 23:00   |
Correct! I get confused as screen y are inverted
wrt the standard cartesian plane. Try:
main {
...
if ((kbd & 1)!=0 && feet_on_floor) {dy=-5;}
y = y + dy;
if (!feet_on_floor)
{dy = min {5, dy +1};}
else
{dy = 0;}
...
}
naturally
#define min(A,B) ( (A) > (B) ? (B):(A))
|
|
AuroraMSX
 msx master Mensajes: 1278 | Publicado: Abril 21 2006, 13:38   |
Quote:
| Correct! I get confused as screen y are inverted
wrt the standard cartesian plane. Try:
main {
...
if ((kbd & 1)!=0 && feet_on_floor) {dy=-5;}
y = y + dy;
if (!feet_on_floor)
{dy = min {5, dy +1};}
|
I think that using ( and ) rather than { and } around the parameters of min will reduce the number of syntax errors with at least one  |
|
ARTRAG msx master Mensajes: 1802 | Publicado: Abril 21 2006, 13:43   |
hit!   |
|
Huey msx professional Mensajes: 672 | Publicado: Abril 21 2006, 14:09   |
Is there an alternative for using fgetc() and fgets()? Seems this is not supported by HITECH
I wanted to load the binairy .stg file from vscreen (copy paste with hex-editor is getting irritating). |
|
|
|
|