Thta was it, thanks a lot

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 Menu
function ChangeNormalView(int base)
{
int MySpriteNo=0;
int currentloop=0;
int currentframe;
while (currentloop <= 7)//invariable
{
currentframe = 0;
while (currentframe <= 8)
{
MySprite2[MySpriteNo] = DynamicSprite.Create(256, 256);
DrawingSurface *MySurface = MySprite2[MySpriteNo].GetDrawingSurface();
ViewFrame *LegViewFrame = Game.GetViewFrame(base, currentloop, currentframe);
MySurface.DrawImage(0, 0, LegViewFrame.Graphic);
ViewFrame *ArmorViewFrame = Game.GetViewFrame(base+1, currentloop, currentframe);
MySurface.DrawImage(0, 0, ArmorViewFrame.Graphic);
ViewFrame *HDViewFrame = Game.GetViewFrame(base+2, currentloop, currentframe);
MySurface.DrawImage(0, 0, HDViewFrame.Graphic);
MySurface.Release();
ViewFrame *MyViewFrame = Game.GetViewFrame(52, currentloop, currentframe);
MyViewFrame.Graphic = MySprite2[MySpriteNo].Graphic;
MySpriteNo ++;
currentframe ++;
}
currentloop ++;
}
player.ChangeView(52);
}
Quote from: Crimson Wizard on Mon 02/09/2024 11:49:44If the operation is the same, but takes longer than in the previous version unexpectedly, then that's something to investigate. I could not tell whether this is the case from what you've said, if it is, then please clarify that?Well in the previous versions, adding regions or walkable areas didn't slow down anything (compared to just changing the background overlay), it's really when I added the walkbehind area that I noticed a change...
Quote from: Crimson Wizard on Mon 02/09/2024 11:49:44Speaking of walk-behinds in particular, if you want to speed things up then you may just create game objects or room overlays with background portions on them instead. Then you won't need to use the walk-behind mask. They will still take time to load up, but engine will not have to do copy-pasting on a surface, and then cutting things out again....But I think using overlays is much faster, not to mention it saves the drawing time which can be quite long, so yeah I'll definitely go for that
Quote from: Crimson Wizard on Fri 23/08/2024 14:20:29This is not a plugin!..
Can you tell what do you do, step by step, and what exactly happens as a result?
DrawingSurface *ds = GetDrawingSurfaceForWalkableArea();
ds.Clear(0);
ds.DrawImage(2005, 1420, 5760); ///This is with your file,since it's just 320*200 I could not put it at 0,0 or it would be too far from my character so I set it manually so the blue area is below the character.
ds.Release();
Quote from: eri0o on Thu 22/08/2024 16:08:12Shoot me a build of your game sometime - I am just curious and have no time for more than writing random bits of text in the forums, but still looks like you are making a nice thing to play.I will as soon as I'm done with the test map![]()
Quote from: Crimson Wizard on Wed 21/08/2024 13:02:51* create dynamic sprite from walkable area's drawing surface (the sprite should be 8-bit)
* fill the sprite with color 1
* use DynamicSprite.CopyTransparencyMask to copy only transparency from the imported sprite to 8-bit sprite
* paste 8-bit sprite back onto walkable area.
function changement_zone(int j){
// j exit direction (0 up, 1 down, 2 left 3 right)
int s;
int t;
if(j==0){ //up
Zone_encours++; //some system to find the right sprite number for the next part of the map
s=player.x;
t=2599;
}
else if(j==1){ //down
Zone_encours--;
s=player.x;
t=201;
}
else if(j==2){//left
Zone_encours+=2;
s=7871;
t=player.y;
}
else{//right
Zone_encours-=2;
s=321;
t=player.y;
}
testmap=Overlay.CreateRoomGraphical(0,0,maptableau[Zone_encours].spritemap); ///the map sprite is found using an
testmap.ZOrder=0;
player.x=s;
player.y=t;
function changement_zone(int j){
// j exit direction (0 up, 1 down, 2 left 3 right)
int s;
int t;
/////remove all the walkable areas
for(int x=1;x<16;x++){
RemoveWalkableArea(x);
}
if(j==0){ //up
Zone_encours++; //some system to find the right sprite number for the next part of the map
s=player.x;
t=2599;
///just restores the appropriate ones
RestoreWalkableArea(1);
RestoreWalkableArea(5); ///since walkable areas (1,2,3,4) don't overlap, it creates a lot of intersections that need to be separate walkable areas (1//2 , 1//3, 1//4, 1//2//3,1//2//4, 1//3//4 and 1//2//3//4)
RestoreWalkableArea(6); //1//2
RestoreWalkableArea(7); //1//3
RestoreWalkableArea(8); //1//4
RestoreWalkableArea(9); //1//2//3
RestoreWalkableArea(10); //1//2//4
RestoreWalkableArea(11); //1//3//4
RestoreWalkableArea(12); //1//2//3//4
}
else if(j==1){ //down
//...
}
}
function mouse_continous_down(){
if(mouse.IsButtonDown(eMouseLeft)&&GUI.GetAtScreenXY(mouse.x, mouse.y)==null&&Character.GetAtScreenXY(mouse.x, mouse.y)==null&&Object.GetAtScreenXY(mouse.x, mouse.y)==null){ ///the exceptions are so you can still interact with the world
Room.ProcessClick(mouse.x,mouse.y, eModeWalkto);
}
}
function repeatedly_execute()
{
mouse_continous_down();
}
function mouse_continous_down(){
if(mouse.IsButtonDown(eMouseLeft)&&GUI.GetAtScreenXY(mouse.x, mouse.y)==null&&Character.GetAtScreenXY(mouse.x, mouse.y)==null&&Object.GetAtScreenXY(mouse.x, mouse.y)==null){
if(GetLocationType(mouse.x, mouse.y) != eLocationNothing){
Room.ProcessClick(mouse.x,mouse.y, eModeWalkto);
}
}
}
Quote from: Khris on Sun 28/07/2024 12:25:21Regarding your code, I assume you put this in a function? Which one?
Quote from: Khris on Wed 24/07/2024 21:49:55It looks like you need to do the following:
First, import a png that has a part of the walkable area (any color for the area, everything else transparent) to define the shape. Repeat for every part of the walkable area.
In game,
1. create a dynamic sprite (1) from the imported shape sprite
2. create a second dynamic sprite (2) and fill it with DrawingColor [AreaNumber] by drawing a rectangle to it
3. use CopyTransparencyMask to copy the transparency from (1) to (2)
4. get the drawing surface for the walkable areas, clear it, then draw sprite (2) to it
You obviously do this in a custom function, passing the area number i.e. color and sprite slot into it.
DynamicSprite*ds2 = DynamicSprite.CreateFromExistingSprite(4177); ///sprite 4177 is a big rectangle the size of the room
ds2.CopyTransparencyMask(4176); ////4176 is the shape i want for the walkable area
DrawingSurface* surfacewalk1 = GetDrawingSurfaceForWalkableArea();
surfacewalk1.Clear(0);
surfacewalk1.DrawingColor = 1;
surfacewalk1.DrawImage(0, 0, ds2.Graphic);
surfacewalk1.Release();
Quote from: Khris on Wed 24/07/2024 18:33:15Just to make sure: you're using AGS 4, right?No I was still on 3.6.1, I hadn't seen 4.0 was already out. So I'll get it to start with "^^ thanks
Quote from: Crimson Wizard on Wed 24/07/2024 18:50:07This is not done with overlays.
If you are changing areas in the room, there's GetDrawingSurface method for all of them:
https://adventuregamestudio.github.io/ags-manual/Hotspot.html#hotspotgetdrawingsurface
https://adventuregamestudio.github.io/ags-manual/Region.html#regiongetdrawingsurface
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_Room.html#getdrawingsurfaceforwalkablearea
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_Room.html#getdrawingsurfaceforwalkbehind
After getting a drawing surface, you may paint a new mask on them.
AGS 4 has slightly different functions.
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.264 seconds with 15 queries.