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: Camera moving exactly with actor  (Read 5244 times)

0 Members and 1 Guest are viewing this topic.

Mihulik

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 71
    • View Profile
Camera moving exactly with actor
« on: February 09, 2011, 12:19:25 PM »

Hi,
I was wondering whether it's possible to make the camera move so that the camera would move exactly with the actor. I mean when the actor starts moving, the scene starts scrolling instantly and when the actor stops moving, the scene stops scrolling instantly too. That would keep the actor in the center of the screen all the time.
I've tried playing with the ScrollSpeedX/ScrollSpeedY/ScrollPixelsX/ScrollPixelsY variables and the movement of the scene is almost as is expected but the scene still sometimes moves even though the actor has already stopped moving.
« Last Edit: February 09, 2011, 01:15:26 PM by Mihulik »
Logged

Spellbreaker

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Gender: Male
  • Posts: 376
    • View Profile
    • Apeiron Studios
Re: Camera moving exactly with actor
« Reply #1 on: February 09, 2011, 06:52:29 PM »

Simply turn autoscroll of, and add scene scrolling to the LeftClick action of the char.
Or :

Simply add a Scene.ScrollTo(actor.X, actor.Y) to the game_loop . ( Also turn autoscroll off ).

But in my opinion thats not a good way of scrolling, it makes the whole game looking anxious.


greets,

Spellbreaker
Logged

Mihulik

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 71
    • View Profile
Re: Camera moving exactly with actor
« Reply #2 on: February 10, 2011, 08:07:49 AM »

I've tried it but it's not what I need but it's my fault-my description is confusing. However, I don't know what I actually need because it isn't my idea. It's an idea of our artist. He should have asked by himself :)
Thanks anyway ;)
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Camera moving exactly with actor
« Reply #3 on: February 12, 2011, 01:38:37 AM »

I've done this in one of my project and I used Scene.SkipTo with manually supplying coordinates. It worked for me.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mihulik

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 71
    • View Profile
Re: Camera moving exactly with actor
« Reply #4 on: February 12, 2011, 09:15:49 AM »

I've tried placing Scene.SkipTo(actor) inside my game loop but the screen was tearing then.
Could you tell me please how you computed the coordinates?
Thanks :)
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Camera moving exactly with actor
« Reply #5 on: February 12, 2011, 11:41:47 AM »

Code: WME Script
  1.  
  2. method TrackMobot()
  3. {
  4.           var posX = Mobot.X + SCREEN_WIDTH / 2; //
  5.           var posY = Mobot.Y + SCREEN_HEIGHT / 2;
  6.          Scene.SkipTo(posX,posY);
  7. }
  8.  
  9.  

You need to turn autoscroll off for this approach to work. Mobot is my actor's entity in this Scene.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mihulik

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 71
    • View Profile
Re: Camera moving exactly with actor
« Reply #6 on: February 16, 2011, 06:55:49 AM »

Thanks :)
Logged
 

Page created in 0.045 seconds with 21 queries.