(double post)
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: Crimson Wizard on Tue 03/01/2023 19:00:19Quote from: jumpjack on Tue 03/01/2023 18:48:15The code snippet I pasted above is taken as-is from my script: all rows are one after the other, all inside the same function; moving the declaration out of the function as first line of the script does not help. The sprite IS drawn and it DOES remain there after function ends... but it's the wrong sprite!
This does not sound normal, I expected Khris's code to work.
If the wrong sprite is one with ID = 0, that's a placeholder, which might mean the dynamic sprite was deleted.
Can you post a code that you tried according to the Khris's advice (and which still did not work)?
Quote from: Crimson Wizard on Tue 03/01/2023 17:28:57When you assign DynamicSprite to an object, it normally is not copied, but referenced by the sprite ID (this is their Graphic property). Like Khris mentioned above, in AGS script dynamic sprites, like overlays, are deleted when the last pointer to them is removed, which happens when the function ends in your case. This is similar to Overlays. As soon as dynamic sprite is destroyed, the game object looses it and switches to sprite 0, which is historically used as a "placeholder".Can a warning message be added in the editor console? This is an "autonomous behaviour", I would expect a "null pointer error" rather than automatically changing to default pointer, but if the "autonomous behaviour" is designed to prevent game crash, maybe a warning to developer would be enough.
Quote from: Crimson Wizard on Tue 03/01/2023 17:28:57Thanks, it works.
Quote from: Khris on Tue 03/01/2023 17:28:42If the first line is inside the function then flipped ceases to exist when the function finishes.The code snippet I pasted above is taken as-is from my script: all rows are one after the other, all inside the same function; moving the declaration out of the function as first line of the script does not help. The sprite IS drawn and it DOES remain there after function ends... but it's the wrong sprite!
It's news to me that AGS keeps a reference to the original sprite and falls back to it but maybe that's how it works internally.
Anyway, the solution is to add
above the function, then do
inside.
Quote from: Crimson Wizard on Wed 28/12/2022 19:39:05I honestly still do not understand why cannot you make the non-walking area further from their tiles to compensate for character's sprite width? I think that would be the first thing I'd try, if I were experimenting with such setup. Would not the result look approximately as if the character's "blocking area" was working the way you implied? Is there anything that prevents using this method?Available walking areas are already quite small, anyway I'll give it a try.
QuoteIsn't pathfinder algorithm hardcoded?Quote from: jumpjack on Wed 28/12/2022 19:35:43Anyway I'll disable mouse and use only keyboard control to override this behaviour.
I might mention that mouse or keyboard (as an input method) do not enforce walking behavior. It's all in the script, how the script reacts to the player's input, which functions it uses. It's possible to call same functions in both cases.
Quote from: Crimson Wizard on Wed 28/12/2022 19:28:53I tried to explain above, that this "hole" is used only to prevent other characters from walking too close to the "solid" character.Yes, this is why it looks like a bug: because the character nonwalkable area behaves differently depending on what touches it: a solid body can't cross it, a solid wall can cross it.
Quote from: Crimson Wizard on Wed 28/12/2022 12:18:41Quote from: jumpjack on Wed 28/12/2022 06:46:34I can't find any example or explanation about sprites collisions management, any suggestion? I see I can monitor collision of objects and characters, but nothing specific about sprites (more specifically: dynamic sprites).
The collisions in AGS may be misleading if not confusing at first; primarily because they were meant to emulate some old adventure games and also assume a side-view game.
1. Characters and Objects have Solid property. If this property is set, they actually paint "holes" inside walkable area mask, and update these "holes" as they move. These are rectangular holes positioned around their "feet", and this is what you may see on a walkable debug overlay. These extra holes prevent other character from walking over, so it looks like a collision test. The sizes of these "holes" are determined by BlockingWidth and BlockingHeight properties.
Painting over a walkable mask yourself (as you already do) would give precisely same result.[...]
Quote from: Snarky on Wed 28/12/2022 17:44:50I suppose the pathfinder might be relevant for NPCs, but it's still not clear why you would need to customize it.
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 0.080 seconds with 19 queries.