[SOLVED] Flipping a sprite in DECORATE.

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
::Bloodfury::
Posts: 332
Joined: Mon Aug 01, 2011 7:39 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

[SOLVED] Flipping a sprite in DECORATE.

Post by ::Bloodfury:: »

Hey!

I have multiple different objects.
And for variety reasons, I would like to Know can you define a sprite frame so it is mirrored?
I would like to use the same graphic creating a new imagelump from the mirrored graphic to be aligned.
I want to save time and not fill my folders with mirrored duplicate images of static objects.

Probably my eye just did not catch this at wiki.
Last edited by ::Bloodfury:: on Fri May 12, 2017 9:04 am, edited 1 time in total.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Flipping a sprite in DECORATE.

Post by Gez »

Well there's the old trick of giving the actor a negative scale.

There's also a new SPRITEFLIP flag that requires a development version.
User avatar
::Bloodfury::
Posts: 332
Joined: Mon Aug 01, 2011 7:39 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Re: Flipping a sprite in DECORATE.

Post by ::Bloodfury:: »

So I would just type TNT1 A -1 and that would mirror the sprite?
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1120
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: Flipping a sprite in DECORATE.

Post by Jekyll Grim Payne »

::Bloodfury:: wrote:So I would just type TNT1 A -1 and that would mirror the sprite?
That's length, it has nothing to do with scale.

Code: Select all

TNT1 A 0 A_SetScale(scalex*(-1),scaley) 
will mirror in on horizontal axis while also retaining whichever basic scale it has (like if it has scale .45 or something). Adjust to your liking.
User avatar
Rachael
Posts: 13960
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Flipping a sprite in DECORATE.

Post by Rachael »

As Gez said, you can use +SPRITEFLIP for this. That also has the advantage of using correct rotations, where "ScaleX -1" will not do that. It does, however, require devbuilds to do this.

If you want to do this dynamically (i.e. random for every object) you can use the following code:

Code: Select all

states
{
    Spawn:
    TNT1 A 0
    OBJC A -1 A_ChangeFlag("SPRITEFLIP", random(0,1))
} 
User avatar
::Bloodfury::
Posts: 332
Joined: Mon Aug 01, 2011 7:39 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Re: Flipping a sprite in DECORATE.

Post by ::Bloodfury:: »

I would like to stay in the official builds. So thus

Code: Select all

TNT1 A 0 A_SetScale(scalex*(-1),scaley)
This would be the way to go?
EDIT: It is not.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Flipping a sprite in DECORATE.

Post by Gez »

Post the full code.
User avatar
::Bloodfury::
Posts: 332
Joined: Mon Aug 01, 2011 7:39 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Re: Flipping a sprite in DECORATE.

Post by ::Bloodfury:: »

I don't currently have any code. I will create lot's of static objects. Candles, skulls etc. And I just would like to know how to mirror the sprite, without using a duplicate image which is flipped.
Since every mirrored objects graphic must be aligned, etc.

But for example, if we would to be use this Hexens hanging ceiling moss. How would you flip the sprite, without creating a completely new graphic.

Code: Select all

ACTOR ZMossCeiling1 //this would be the original.
{
  Radius 20
  Height 20
  +SPAWNCEILING
  +NOGRAVITY
  States
  {
  Spawn:
    MSS1 A -1 
    Stop
  }
}

ACTOR MirroredZMossCeiling1 //And this would be mirrored.
{
  Radius 20
  Height 20
  +SPAWNCEILING
  +NOGRAVITY
  States
  {
  Spawn:
    MSS1 A -1 //So something has to be done here.
    Stop
  }
}
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: Flipping a sprite in DECORATE.

Post by Arctangent »

Actually, it doesn't. You can set the actor's scale as one of its properties, meaning that all you need is:

Code: Select all

ACTOR MirroredZMossCeiling1 : ZMossCeiling1 { XScale -1.0 }
This is ignoring the fact that if you use UDMF for your map, you can set the actor's scale right on the map, meaning you don't even need to create a new actor.
User avatar
::Bloodfury::
Posts: 332
Joined: Mon Aug 01, 2011 7:39 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Re: Flipping a sprite in DECORATE.

Post by ::Bloodfury:: »

Yeah I'm using UDMF and indeed the actor scale could be manipulated right in the editor! I don't see why anyone would use any other map format these days.
Except vanilla maps. But hey. This solves the issue! Thank you so very much kind people! :) And the best part is by far that I do not need to create a duplicate actor!
Locked

Return to “Editing (Archive)”