Perhaps try using "late_repeatedly_execute_always" function instead.
https://adventuregamestudio.github.io/ags-manual/RepExec.html
https://adventuregamestudio.github.io/ags-manual/RepExec.html
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: Snarky on Mon 03/06/2024 20:47:23Alternatively, users can write a pathfinding algorithm for polygon-based regions, and use the new WalkPath() method to apply it. This would enable e.g. overlapping walkable areas.
Quote from: Snarky on Mon 03/06/2024 18:57:54Quote from: Crimson Wizard on Mon 03/06/2024 15:42:15We need a pathfinder that works with a list of geometric shapes instead.
Do we, though? Why?
Quote from: Snarky on Mon 03/06/2024 15:37:26Though by exposing the pathfinding API as you've just been working on, @Crimson Wizard, it becomes possible to implement vector-based walkable areas (and editing) within AGS.
Quote from: Walmaker on Mon 03/06/2024 14:14:27I like the walkboxes better because with the four corners of each box being connected, it gives the engine a good idea of how a walkable area should be like at an angle, making the character's movement much smoother (even if it's movement is linked with the animation). Whereas the draw-in walkable areas in are too pixely to understand what part of the WA is a straight line or what part is at an angle, making the movement of the characters clunky when their movement is linked with their animation.
builtin managed struct Pathfinder {
/// Tries to find a move path from source to destination, returns an array of navigation points.
Point*[] FindPath(int srcx, int srcy, int dstx, int dsty);
/// Traces a straight path from source to destination, returns the furthermost point reached.
Point* Trace(int srcx, int srcy, int dstx, int dsty);
};
builtin managed struct MaskPathfinder extends Pathfinder {
/// Creates a new MaskPathfinder, initialized with the given 8-bit mask sprite
static MaskPathfinder* Create(int mask_sprite);
/// Assigns a new mask to this MaskPathfinder
void SetMask(int mask_sprite);
};
struct Room {
<...>
/// Gets this Room's Pathfinder object that lets find route around walkable areas.
readonly Pathfinder *PathFinder;
}
/// Moves the character along the path, ignoring walkable areas, without playing his walking animation.
function Character.MovePath(Point*[], BlockingStyle=eNoBlock);
/// Moves the character along the path, ignoring walkable areas, automatically playing his walking animation.
function Character.WalkPath(Point*[], BlockingStyle=eNoBlock);
/// Returns the moving path of this character, or null if it's not moving
Point*[] Character.GetPath();
/// Moves the object along the path, ignoring walkable areas.
function Object.MovePath(Point*[], int speed, BlockingStyle=eNoBlock);
/// Returns the moving path of this object, or null if it's not moving
Point*[] Object.GetPath();
DynamicSprite *pathspr;
DynamicSprite *mask_copy;
Overlay *pathover;
function on_mouse_click(MouseButton button)
{
if (pathover == null)
{
pathspr = DynamicSprite.Create(Room.Width, Room.Height);
pathover = Overlay.CreateRoomGraphical(0, 0, pathspr.Graphic);
}
if (mask_copy == null)
{
mask_copy = DynamicSprite.Create(Room.Width, Room.Height);
}
DrawingSurface *mask_copy_ds = mask_copy.GetDrawingSurface();
DrawingSurface *mask = WalkableArea.GetDrawingSurface();
mask_copy_ds.Clear(30);
mask_copy_ds.DrawSurface(mask);
mask.Release();
mask_copy_ds.Release();
Point *goal = Screen.ScreenToRoomPoint(mouse.x, mouse.y);
Pathfinder *finder = Room.PathFinder;
Point *path[] = finder.FindPath(player.x, player.y, goal.x, goal.y);
Point *trace = finder.Trace(player.x, player.y, goal.x, goal.y);
DrawingSurface *ds = pathspr.GetDrawingSurface();
ds.Clear(COLOR_TRANSPARENT);
ds.DrawImage(0, 0, mask_copy.Graphic, 50);
if (path != null)
{
for (int i = 0; i < path.Length; i++)
{
if (i > 0)
{
ds.DrawingColor = 1;
ds.DrawLine(path[i - 1].x, path[i - 1].y, path[i].x, path[i].y);
}
ds.DrawingColor = 4;
ds.DrawRectangle(path[i].x - 1, path[i].y - 1, path[i].x + 1, path[i].y + 1);
}
}
if (trace != null)
{
ds.DrawingColor = 12;
ds.DrawLine(player.x, player.y, trace.x, trace.y);
}
ds.Release();
}
Quote from: Jordanowen42 on Sun 02/06/2024 00:07:44Thank you- sorry for the silly problem.
Quote from: Jordanowen42 on Sun 02/06/2024 00:12:05Another question- how do I implement these things without screwing up my game?
Quote from: Snarky on Sat 01/06/2024 07:16:50In terms of how this would actually work, Crimson Wizard, are you thinking that players would configure it in winsetup.exe (or by editing the cfg file), and it would adjust the default color and volume values set in the editor?
Because as we know, AGS games don't come with any default in-game configuration UI.
Also, this would only work if the game developer never uses the script API to overrule the starting values set in the editor, because then they become hardcoded. My intuition is that most games do set these values in script at some point, and so this solution would have quite limited effectiveness, but I might be wrong about that.
Quote from: gendiskan on Thu 30/05/2024 22:31:22* Adjustable text size, color, and opacity, including fonts for players with dyslexia.
* High contrast filters to highlight characters and interactive elements.
* Filters for major types of color blindness: Protanopia, Deuteranopia, and Tritanopia.
* Sound adjustments (mono or stereo) and volume settings for effects, music, and voices, if any.
Quote from: gendiskan on Thu 30/05/2024 22:31:22* Analog control, allowing players to navigate menus and interactive elements with keys or buttons.
Quote from: gendiskan on Thu 30/05/2024 22:31:22* Screen reader compatibility to verbalize menus, texts, and subtitles.
Quote from: gendiskan on Thu 30/05/2024 22:31:22* Compatibility with keyboard, gamepad, and Xbox Adaptive Controller to connect specific controllers for all types of motor impairments.
Quote from: speksteen on Wed 29/05/2024 02:34:12Moho is vector based but it can export raster based gifs. Any idea on the maximum number of sprites per view? I tried looking it up in the manual but couldn't find it.
int NUM_ITEMS_TO_FILL = 1000;
for (int i = 0; i < NUM_ITEMS_TO_FILL; i++)
{
Item[i].name="blablablabla"; // or generate a random name, there are also ways to do that
Item[i].sprite = Random(MAX_SPRITES);
Item[i].data = ...
}
Inventoryitem*selected=inventoryitem.GetatscreenXY(mouse.x,mouse.y);
int my_index = selected.GetProperty("MyIndex");
item[my_index]....
for (int i = 0; i < Game.InventoryItemCount; i++)
{
InventoryItem *invitem = inventory[i];
for (int myitem = 0; myitem < itemlimit; myitem++)
{
if (invitem.name==item[myitem].name){
invitem.SetProperty("MyIndex", myitem);
break;
}
}
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 7.020 seconds with 16 queries.