No idea if this is even something vaguely feasible within AGS, but I thought I might as well ask.
Anyhow, I was wondering if it was possible to change what parts of the room had what hotspot in them, during the game itself? As in, at a point in a script, the game checks x,y coords, and if there's hotspot at this coordinate, to change it to hotspot 0? And from there, I can make use of maths to govern what shapes to change the hotspots by.
The idea is for creating deforming terrain, using circles for the "explosion" to take a chunk out of the hotspot. Is this feasible? Is there another better route you might suggest? Or is this a situation where ambition has overstepped physical capability?
You can't change the shape of hotspots but you can work around that.
Keep a DynamicSprite in memory and draw to it. You can then check the color of a specific pixel using DrawingSurface.GetPixel.
Ah, super, I can work with that instead. Now, I just have to get the hang of the drawingsurface!
Seems like Objects or Characters is what you want?
Could you elaborate? To change the shape of something in a Worms kind of way i.e. adding holes to a landscape, one would need a DynamicSprite anyway. So why not use that to detect clicks directly?
If worms is what you're trying to make, then a short answer is yes. It's very possible in AGS.
I just spent the last half hour trying to recover my old worms clone that I made with AGS, so I could share it with you. It was on an old hard drive on my old computer, but I couldn't seem to find it. It must have been deleted somehow, at one point.
My approach, I had two backgrounds (like animating backgrounds). The first background was the background that contained full detail on sky and land. The second background had a transparency color for the sky, and the land was the darker background layer which replaces the top background to reveal the damaged land.
To calculate for an explosion, you'd check to see if the second background area did not contain the sky transparency color. If it was indeed ground I would draw, pixel per pixel, the ground from the second background onto the first background. While you do that, you also draw the sky transparency color onto what used to be ground on the second background.
That way the second background not only was the bottom layer of land but it was also the 'hotspot', except it worked in reverse. If it's not the transparency color, then it is ground.
If I were to attempt to make that worms clone again, I would definitely use sprites instead. One sprite for the top layer of land, and one sprite with the bottom layer of land. Then you'd only have a small 640x480 (or whatever resolution) as the background, and you can use the two land sprites as objects, overlapping each other. Moving them around as the 'fake' viewport moves around.
Then all you'd need to do is draw the explosion circle on the top layer with the transparency color, which would reveal the bottom layer. And to check for ground, you just check against the top layer if it isn't the transparency color.
Also the benefit for doing that, is you get unlimited sky and side view without having it limited by the background size. And you're not loading a large background and sky into the drawing surface each time you want to check a pixel for collision detection or explosion. Only the land (or most of it). You could also break up the land sections in multiple objects and sprites to speed things up even more.
Only drawback with doing it the sprite and object way, is that you need extra scripting to determine where the explosion happened via the object's X and Y position. Could be tricky to some novice programmers.
I'm not sure why I didn't do it this way when I had first made it, I guess I was kinda new to drawing surfaces and whatnot. Like I said, it's definitely the better method and I would totally do it that way if I were to do it again.
Yes indeed, it's sort of a Worms effect that I'm going for. So, it looks like the sprite is the way to go, then! So, to make sure I understand - is there a way of making two separate layers of dynamicsprites within the room, or is it a case of a normal sprite for the indestructible back bit, and a dynamic one for the destroyable? Or have I just completely misunderstood?
Yes, you're understanding correctly.
And yes, you wouldn't have to touch the backing sprite, but the front sprite would have to be loaded into a DynamicSprite.
There aren't any limits with DynamicSprite that I'm aware of. I believe they're just like variables which are limited by memory. So you could do multiple layers of destruction, if you needed to.