April 28, 2024, 10:05:15 PM
Welcome,
Guest
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Latest WME version:
WME 1.9.1
(January 1st, 2010) -
download
Home
Help
Search
Calendar
Login
Register
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
Order of images
« previous
next »
Pages: [
1
]
Print
Author
Topic: Order of images (Read 3158 times)
0 Members and 1 Guest are viewing this topic.
eborr
Regular poster
Karma: 4
Offline
Posts: 196
Order of images
«
on:
August 05, 2009, 08:50:02 PM »
I have dynamically created 3 entities, each of which will store an image, one of the images is a background, the other 2 should show in the foreground.
I am struggling to get the images to appear in the correct order, EG the background down first and then the other two on top. However the ordering of the images changes if I vary the X co-ordinate of the background
Code: WME Script
// background entity
var
backg =
Scene
.
CreateEntity
(
)
;
//foreground
var
npc =
Scene
.
CreateEntity
(
)
;
var
tre=
Scene
.
CreateEntity
(
)
;
backg.
X
=
0
;
backg.
Y
=
458
;
backg.
SetSprite
(
"interface\paper1000.png"
)
;
tre.
X
=
0
;
tre.
Y
=
468
;
npc.
X
=
50
;
npc.
Y
=
468
;
npc.
SetSprite
(
"theads\furst.png"
)
;
tre.
SetSprite
(
"theads\ron.png"
)
Any ideas, I am aware that I could solve the problem be creating nodes in scenes, however this is code that I want to re-use
«
Last Edit: August 05, 2009, 10:05:31 PM by Jyujinkai
»
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: Order of images
«
Reply #1 on:
August 05, 2009, 09:08:14 PM »
Scene.CreateEntity() creates a "free" entity. These entities are sorted by their Y position on screen.
If you want to reproduce adding nodes in SceneEdit, use the AddEntity() method of scene layers.
Code: WME Script
var
Layer =
Scene
.
MainLayer
;
Layer.
AddEntity
(
"some name"
)
;
Layer.
AddEntity
(
"some other name"
)
;
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
eborr
Regular poster
Karma: 4
Offline
Posts: 196
Re: Order of images
«
Reply #2 on:
August 05, 2009, 09:17:39 PM »
thank you, in these circumstances then answer I think is a combination of CreateEntity and AddEntity, I have worked out a solution by creating a background node in the scene editor, maybe not the most elegant, but it works
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: Order of images
«
Reply #3 on:
August 05, 2009, 09:25:22 PM »
Using these methods you can programatically do pretty much anything you can do manually in SceneEdit. Except adding a new waypoint group, that is.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Print
Pages: [
1
]
« previous
next »
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
Order of images