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: Window Object and Scale Level  (Read 6538 times)

0 Members and 1 Guest are viewing this topic.

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Window Object and Scale Level
« on: March 23, 2016, 02:13:51 PM »

Hello to all,
I would need an object to be moved on the screen that is influenced by the scale level. It sounds easy... (maybe it is but I do not find the solution).
When the character acquires an item I want to release the item from the bottom, it rises up in the center of the screen and then enters in the icon inventory ...
This movement must be subject to the scale level.
The problem is that in my scene there are different objects, sprite entity, region entity, region, free entities and if to make the animation described above I use a sprite or a free entities (in accordance with the objects it encounters and their hotspot) it is not always visible but it remains covered by some objects.
The only solution I found is to use a window object that is always in front of all objects in the scene.
But despite the manual suggests the Scalable option the sprite does not change size according to the scale.
This using the sprite as a background of windows or as an Entity Container.
Does anyone have idea why the object in the windows is not affected by the scale of the scene or where I'm wrong?
Even alternative suggestions are welcome.
Thank you
Logged

eborr

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 196
    • View Profile
Re: Window Object and Scale Level
« Reply #1 on: March 23, 2016, 02:35:57 PM »

as far as I know windows are not subject to scale, thus even though it's in a container, if the container is not subject to scale then an object within it won't be either.

I have a couple of thoughts for coding round the problem, none of them have been tried or tested so use at your own risk.

1. If you create an entity with create object, then it will be created at the top of the z-order for all scene based nodes, obviously if you have on screen elements which are windows based then these will be on top.

2. This will take a lot more coding but maybe it will solve the problem. Although a screen based scale cannot directly effect an entity within a container(or so I think) you may be able to create an algorithm that reads the scene scale at a given Y point then applies a scale to the entity itself. If this does not work, then another option would be to create a number of differently scales frames within a WME sprite. All you do then is have a persistent routine which checks the position of the Y of the object on the screen and selects the appropriate frame.

if you are made enought to attempt any of these ideas please share the results
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Window Object and Scale Level
« Reply #2 on: March 23, 2016, 02:36:38 PM »

There is a way to make some entity always on top:

1) add a new region to the bottom of all nodes in SceneEdit, name it e.g. "topmost".
2) attach your entity permanently to this region: someEntity.StickToRegion("topmost");

Of course, you'd have to create this "topmost" region in every scene, but it could be automated by a script that would automatically add said region everytime a scene is loaded.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Re: Window Object and Scale Level
« Reply #3 on: March 23, 2016, 03:08:25 PM »

Thanks for your answers.
We were writing nearly all together :) .
I had found another solution, create a new layer and its own sprite and place it after Main. It seems to work, sprite is affected by the scale level and it is always on top, but perhaps some proposed solutions are better in terms of resource consumption ..? I'm going to try, my scenes are pretty heavy and where it is possible it is better to save too much work at the Engine.
Thank you.
Logged

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Re: Window Object and Scale Level
« Reply #4 on: March 23, 2016, 03:56:46 PM »

as far as I know windows are not subject to scale, thus even though it's in a container, if the container is not subject to scale then an object within it won't be either

Strangely the manual, in the section Script language reference, under the item Window object and also Entity container object, in the section Attributes of either, mentions Scalable with Movable, Rotatable and Colorable.

1. If you create an entity with create object, then it will be created at the top of the z-order for all scene based nodes,

I have created a sprite entity and a free entities directly in SceneEdit.
Moving them with the mouse on the screen the sprite was hidden depending on the location of the hotspots of some objects on the scene.
This happens in any position I put the sprite in the node window.

I have not, however, tried to create the object at runtime

you may be able to create an algorithm that reads the scene scale at a given Y point then applies a scale to the entity itself.

I'm not quite sure but I seem to have tried to change the scale at runtime (without a real algorithm) and I seem to remember that it did not work (with window container)

If this does not work, then another option would be to create a number of differently scales frames within a WME sprite. All you do then is have a persistent routine which checks the position of the Y of the object on the screen and selects the appropriate frame.

In this case I had done something similar with photoshop creating an animation of the item, about 20 frames from large to small and vice versa, also changing in the last few frames opacity to give the impression of fading, and it was ok, but how much work for each item!

Being able to use the scale level of Engine would be sufficient only one frame and the fade is created directly from the script
« Last Edit: March 23, 2016, 04:41:47 PM by valter.home »
Logged
 

Page created in 0.037 seconds with 20 queries.