Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Scene entity sprite order  (Read 6892 times)

0 Members and 1 Guest are viewing this topic.

redfox

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 122
    • View Profile
Scene entity sprite order
« on: July 22, 2014, 11:30:09 AM »

Is there a way to change the Z-order of entity sprites already in a Scene using a code method? Ideally I would want to jump a clicked on scene entity sprite to the visual top of other sprites.

I see Z-order for windows, buttons, but not for Scene entity sprites.

Thanks
Logged

ciberspace

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 116
    • View Profile
    • Tele Juego
Re: Scene entity sprite order
« Reply #1 on: July 24, 2014, 07:33:35 AM »

Can it be?
Frame object
The Frame object allows you to access the properties of your animation frame. Frame objects can be queried using the Sprite.GetFrame and Sprite.AddFrame methods.

Note: If there is only one subframe, all the subframe methods and attributes also apply to a frame object.



Methods
Actions 
GetSound Returns the sound assigned to this frame.
SetSound Assigns a sound to this frame.
GetSubframe Returns a subframe of this frame.
AddSubframe Adds a new subframe to this animation frame.
InsertSubframe Inserts a new subframe to this animation frame.
Deletesubframe Removes specified subframe from this animation frame.
GetEvent Returns an event assigned to this frame.
AddEvent Adds an event to this frame.
DeleteEvent Removes an event from this frame.

Attributes
Type (read only) Returns always "frame"
Delay The delay of this frame (in milliseconds)
Keyframe Specifies if this frame is a keyframe (not used).
KillSounds Specifies if this frame should stop all currently playing sounds started by this sprite.
MoveX Specifies the X movement applied to the owner object by this frame.
MoveY Specifies the Y movement applied to the owner object by this frame.
NumSubframes (read only) Returns the actual number of subframes if this frame.
NumEvents (read only) Returns the number of events assigned to this frame.

redfox

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 122
    • View Profile
Re: Scene entity sprite order
« Reply #2 on: July 28, 2014, 03:12:53 PM »

Accessing the sprite frames may be useful for other scenes I am working on, so thank you for that.

But at the moment I am still trying to change the Z-order of the entities in a Scene. 
Logged

Dan Peach

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 100
    • View Profile
    • Viperante - Game Development
Re: Scene entity sprite order
« Reply #3 on: July 29, 2014, 06:02:47 PM »

I seem to remember wanting to do this once. I don't think it's possible. I think I ended up swapping the sprites contained in the entities. That kinda achieves the same thing. :)

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Scene entity sprite order
« Reply #4 on: July 30, 2014, 12:35:33 AM »

what's the problem with swapping entity z-orders? You can usually achieve everything similar with StickToRegion()
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

redfox

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 122
    • View Profile
Re: Scene entity sprite order
« Reply #5 on: August 08, 2014, 02:15:22 PM »

I have a scene with sprites entities. They are visually items that can be clicked and dragged about, and when released I wanted that item to be on top of the others. But because the Spites are already preset up in the scene, the dragged sprite remains under others.

I thought perhaps I could use the Scene.CreateEntity to make a new version of my sprite item, and delete the original one remaining below? I guess I would need to attach the Script and set the cursor so that item can be dragged about again after.

I shall try working on that method again, but I still need all my movable sprites to remain underneath other graphical location sprites, so those will have to be placed on another layer perhaps.
Logged
 

Page created in 0.043 seconds with 22 queries.