Mittens 2018 will be in Boston this September. There are three spaces left, so check out the thread for details!

Recent Posts

Pages: 1 [2] 3 4 ... 10
can I change the graphics of this panel? I miss only this to change to be in theme with my game

my graphic
One way to do it that comes to my mind, would be to import the background with all of the objects and characters visible, as a sprite. Then assign that sprite to a new character, and set the scaling of a new blank room so that the "background" character starts off slightly small, and then gets slowly bigger. Then all you need to do is switch to the actual room that it's zooming into after it's finished, and the crossfade should trick the player into thinking they just saw that room actually zoom in.

The only downside is that you can't move while it's zooming in, and you have a lot of editing to do if you want to change anything in that room.

it was better if I could do it as an object, and then put it in a layer below, so that underneath me the background and I could give it a setsize, and the objects above could be seen, pity that you can not level the objects
I will be frank, the code that I see on your pic is pretty weird.

You first draw the tree sprite onto room-sized surface in original size, then resize the surface... I think that means that not only width and height of the tree will be changed, but its X and Y will also change (final tree image may get shifted away from the position you wanted).
Also, I cannot make any sense out of adding propScale to the surface's sizes. If that's really is a scale factor, then it's wrong, so that's probably not the scale factor, but the final tree size?? or not....

By the way, the Baseline calculation is also wrong. You are using original coordinates propY and Game.SpriteHeight to calculate its position, but they are no longer applicable to the final resized image. You should be multiplying these values by the image scale factor (see below).

If you look for the DrawImage article in the manual, you will see that it has optional width and height parameters. They let you resize an image when you are drawing it.
So the resizing code should probably look like this:
Code: Adventure Game Studio
  1. int scale ... // assuming you calculated scale somehow
  2. int orig_width = Game.SpriteWidth[prop[i]];
  3. int orig_height = Game.SpriteHeight[prop[i]];
  4. int final_width = orig_width * scale;
  5. int final_height = orig_height * scale;
  6. EnvPropSurface[i] = EnvProp[i].GetDrawingSurface();
  7. EnvPropSurface[i].DrawImage(propX[i], propY[i], prop[i], 0, final_width, final_height);
  8. EnvPropSurface[i].Release();
In such case there is no need to resize large dynamic sprite, and also prop coordinates stay the same.

Alright, that said, if we still stick to your formulas, then to calculate the "block" object position you need to know following:
1) The size and position of Blocking area relative to the original sprite's size. This you have to define yourself, because only you know it, and you draw these sprites.
Let's call these OrigBlockX, OrigBlockY, OrigBlockWidth and OrigBlockHeight.
2) The size and position of Blocking area relative to the resized sprite. For these you need to multiply previous values by the same factor you are using to resize the sprite.

Since you are resizing whole final image, then every coordinate has to be resized as well:
Code: Adventure Game Studio
  1. // The scale factor is a relation between final size of large dynamic sprite and its original size
  2. // (normally I'd suggest to use Room.Width and Room.Height here instead of literal numbers)
  3. float ScaleX = IntToFloat(propScale[i] + EnvProp[i].Width) / 1920.0;
  4. float ScaleY = IntToFloat(propScale[i] + EnvProp[i].Height) / 1080.0;
  5. ScaledBlockX = FloatToInt(IntToFloat(OrigBlockX * ScaleX));
  6. ScaledBlockY = FloatToInt(IntToFloat(OrigBlockY * ScaleY));
  7. ScaledBlockWidth = FloatToInt(IntToFloat(OrigBlockWidth * ScaleX));
  8. ScaledBlockHeight = FloatToInt(IntToFloat(OrigBlockHeight * ScaleY));
Again, these coordinates are positions of the blocking area related to the resized sprite's local coordinates. This is not final.

How to find the position of the blocking rectangle in the room:
Code: Adventure Game Studio
  1. // This is where your resized tree is actually positioned in the room
  2. int RealPropX = object[i].X + FloatToInt(IntToFloat(propX[i] * ScaleX));
  3. int RealPropY = object[i].Y + FloatToInt(IntToFloat(propY[i] * ScaleY));
  4. // So, and the blocking object rectangle will be
  5. int BlockRoomX = RealPropX + ScaledBlockX;
  6. int BlockRoomY = RealPropY + ScaledBlockY;
  7. int BlockRoomWidth = ScaledBlockWidth;
  8. int BlockRoomHeight = ScaledBlockHeight;

EDIT: Realized a bit later, but we may actually skip ScaledBlockWidth/Height part and do following:
Code: Adventure Game Studio
  1. float ScaleX = IntToFloat(propScale[i] + EnvProp[i].Width) / 1920.0;
  2. float ScaleY = IntToFloat(propScale[i] + EnvProp[i].Height) / 1080.0;
  4. int BlockRoomX = object[i].X + FloatToInt(IntToFloat((propX[i] + OrigBlockX) * ScaleX));
  5. int BlockRoomY = object[i].Y + FloatToInt(IntToFloat((propY[i] + OrigBlockY) * ScaleY));
  6. int BlockRoomWidth = FloatToInt(IntToFloat(OrigBlockWidth * ScaleX));
  7. int BlockRoomHeight = FloatToInt(IntToFloat(OrigBlockHeight * ScaleY));
That should give identical results.

NOTE: the actual Baseline formula is also:
Code: Adventure Game Studio
  1. int RealPropY = object[i].Y + FloatToInt(IntToFloat(propY[i] * ScaleY));
  2. int RealPropHeight = FloatToInt(IntToFloat(Game.SpriteHeight(prop[i]) * ScaleY));
  3. object[i].Baseline = object[i].Y - Room.Height + RealPropY + RealPropHeight);

Now, I have to admit that I did not test all this, but only figured in my head. So I cannot 100% guarantee that's correct. I'd need to have actual test game on my computer to experiment with.
In any case, I strongly advise to clarify the resizing code you are using. Especially since you say yourself that you do not know the reason behind some formula. Because as you progress further this situation will only worsen...
Competitions & Activities / Re: Game pitch competition
« Last Post by Blondbraid on Today at 16:29 »
What a fun idea, I just sent one of my many ideas for adventure games in a PM.
The Rumpus Room / Re: Happy Birthday Thread!
« Last Post by AnasAbdin on Today at 16:22 »
Happy birthday to Grim!

+1 :)
The Rumpus Room / Re: Name the Game
« Last Post by Gilbert on Today at 16:09 »
The Rumpus Room / Re: Name the Game
« Last Post by dayowlron on Today at 15:20 »
Mean Street, I think.
Correct, I knew it would be easy although it is "Mean Streets"
It's actually a wrapper for running Windows games, written for older versions of DirectX, in case you have problems making them to work on modern Windows.
I was confused at first as there is absolutely no info. on what this is on the software's page, but backing out to the site's home does tell you what it is.
The Rumpus Room / Re: Name the Game
« Last Post by Gilbert on Today at 14:50 »
Mean Street, I think.
If it was started in April I don't see why not...
Pages: 1 [2] 3 4 ... 10