Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Diagonal scene?  (Read 4238 times)

0 Members and 1 Guest are viewing this topic.

Tales

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 10
    • View Profile
Diagonal scene?
« on: November 20, 2005, 06:48:21 PM »

Hi,

is it possible to build a scene diagonally...that the camera is in a diagonal angle.
The character may not walk straight, like in "normal" screens.

Any suggestions?

Tales
Logged

organican

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 74
    • View Profile
Re: Diagonal scene?
« Reply #1 on: November 20, 2005, 11:47:01 PM »

Interesting idea.

I think it should be doable... I think.

With a little scripting...

Just as long as the scene is no more than one screen "wide".

(Like this:)
Code: [Select]
\___\
  \___\
    \___\
      \___\
        \___\

And here's how I did it.

First I created an "empty" entity in the scene - no sprite, no nothing.
I called it "diagonal_camera"

You can call it what you wish of course.

Then I attached a script to it.
And in the script, I wrote:

Code: [Select]
while(true)
 { this.X=actor.X;
   this.Y=actor.X;
   Sleep(50);
 }

Then all I had to do was to add the lines
Code: [Select]
var diagonal_camera = Scene.GetNode("diagonal_camera");

Game.MainObject = diagonal_camera;


in the scene.init script

Hope this works!
Logged

McCoy

  • The cocido eater
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 365
  • Spurrrrrrring
    • View Profile
    • Spur Games
Re: Diagonal scene?
« Reply #2 on: November 21, 2005, 07:45:55 PM »

I don't understand what your script does, Organican... can you please explain?

And for Tales: Do you mean an scene in isometric view?
Logged

Click here to sign my sig!

Tales

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 10
    • View Profile
Re: Diagonal scene?
« Reply #3 on: November 22, 2005, 12:25:28 AM »

Hi,

I meen not an isometric-screen.
I meen I want in a few scenes not an straight camera, but a diagonally camera.

Here is a example how it should be.
(It' s only an 2D picture taken from MonkeyIsland3, but I want to make this function into a 3D Scene]

"normal" staight camera with an upright character


diagonally camera with an not straight character



Do you know what I meen??
Logged

organican

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 74
    • View Profile
Re: Diagonal scene?
« Reply #4 on: November 22, 2005, 12:46:48 AM »

I don't understand what your script does, Organican... can you please explain?

Okay...

Quote
First I created an "empty" entity in the scene - no sprite, no nothing.
I called it "diagonal_camera"

You can call it what you wish of course.

Here I made an invisible entity in SceneEdit that I will attach the camera to in a moment. It will be controlling the scrolling.

Quote
Then I attached a script to it.
And in the script, I wrote:

Code:

while(true)
 { this.X=actor.X;
   this.Y=actor.X;
   Sleep(50);
 }
This means that the diagonal_camera entity's x and y positions will be the same as the actors.

If the actor is at x200, then the diagonal_camera will be at x200 y200. If he's at x350, it will be at (350, 350).
And when the camera control is attached to it, the scene will scroll from the upper-left corner to the lower-right, diagonally.

Quote
Then all I had to do was to add the lines
Code:

var diagonal_camera = Scene.GetNode("diagonal_camera");

Game.MainObject = diagonal_camera;

in the scene.init script
The line Game.MainObject = diagonal_camera;
means that the diagonal_camera entity will be given control of the scrolling.

If the scene is turned the other way

    /--/
   /--/
  /--/
 /--/
/--/
<-2500->

Then you have to do some calculations.

Take the width of the game area and subtract the width of the screen from it.

If the game area is 2500 pixels across, and the screen size is 800*600,
then you calculate 2500-800=1700

Next you type this in the diagonal camera_script instead:

while(true)
 {
   this.X=actor.X;
   this.Y=1700-actor.X;
   Sleep(50);
 }

And do everything else like the other example.

I haven't tried this code, though. But it should work just like the other one that I tried.
Simple math.

Update:
Tales just posted in the thread and explained just what he meant by diagonal.
I see...

In that case...
No, I'm not sure how that can be done.

But it's a very interesting concept, Tales.


Update again:

I think it can be done if you rotate the background image like you already did.

Then if you rotate the actor with the rotate code
Code: [Select]
actor.Rotate=-45;both the scene and the character will be seen from the new camera angle.

Just remember to add the line
  ROTATABLE = TRUE
in the actor file.

For molly (from the wme demo), the file is called molly.actor

In it, it should look something like this:

Code: [Select]
; $EDITOR_PROJECT_ROOT_DIR$ ..\..\..\

ACTOR
{
  NAME = "molly"
  CAPTION=""
  SCALABLE = TRUE
  ROTATABLE = TRUE
  ...

You can open it up in notepad.

This could be one way to do it. To rotate every actor and entity like this (and rotate the background in a graphics program).
Not sure if it would use a lot of processing power though.

It's worth a try at least.

Edit again

I noticed that the scale levels in WME only works horizontally.

So that means that the scene can't have any scaling in the "z dimension", because it will look wierd if things to the right looks bigger etc.

So the only way to do this then, is to either have very little rotation in the scene, just a few degrees.

Or... if the scene's walkable area is "paper thin", or flat, like a 2d platformer (Mario) or something...
or if it just takes place in one plane... like a narrow path...
then it might work. But unfortunately, with horizontal scale levels, you have to find a way to do without the scaling in such a scene.

Though it might be worth it if the character and the scene is rotated, 60 degrees to the left or something.
That would be really cool.

But it means that the actor can't walk in the "z direction", towards and away from the screen... in the "depth" dimension.
Because he'll become bigger when he moves to the right if it looks like your picture.

So if you can do this, you will probably just use it in a few scenes. Because the player can't walk around much.

Sorry :(

This was the best I could do.
« Last Edit: November 22, 2005, 07:28:20 AM by organican »
Logged
 

Page created in 0.046 seconds with 24 queries.