adonthell-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-general] New map engine implementation started! :)


From: Alexandre Courbot
Subject: [Adonthell-general] New map engine implementation started! :)
Date: 07 Feb 2002 22:59:01 +0100

It's started! I'm implementing the new map engine basics, starting with
static & moveable objects positions.

I'll expose the idea here so you guys can give your opinion on it.

As you can already guess, a position on the map is an x, y coordinate,
representing the tile the object is on, plus now an ox, oy offset.

Static objects (the new "mapobjects" for example) only have these
position attributes.

Moveable objects (including mapcharacter) inherit from this class and
adds two floats: vx and vy, for x and y velocity. Why floats? Two main
reasons:

1) Remember the old days of the island map, where characters could only
move 1 pixel per pixel, or 2 pixels per pixels, or wait several cycles
before moving one pixel... This was awfull to look. Now, if you have a
character that have a speed of 1.0, and want another one to go a little
faster, just sets his speed to 1.1. Et voila. To make them run, just
double their speed (or whatever operation you like). Simple and
efficient.

2) During fights, it may happen that characters will have to move in
another direction than the 8 ones you can reach via the controls - for
example to follow the shortest path to an ennemy. This is now possible
to allow such moves, by setting for example X velocity to 1.0 and Y
velocity to 0.25. See what I mean?

Just what I have done this evening, but it's already a few classes. Now
that coordinates are classes too, they can be easily compared and
affected, which is very handy. I have a little test program running that
allows you to move a character using this system. I've tested with
different speeds, the movment is always smooth and good looking. Of
course there is no map now - he's just running on a black screen, but
that a good debut! :) I hope I'll have a basic map system (no
walkability, no levels, no submaps) soon so you can all see - but I'll
have to clean the 0.4 branch first, as it will be a true mess otherwise!

Alex.
PS: I had serious problems retrieving my mails & connecting to
linuxgames today. I seem to have lost a few mails too (I only received
one mail from the minigame list). Does anyone else experienced problems
too?

-- 
http://www.gnurou.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]