Author Topic: movement:set/get_speed issue ?  (Read 1625 times)

0 Members and 1 Guest are viewing this topic.

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
movement:set/get_speed issue ?
« on: August 02, 2016, 10:10:37 PM »
Hi.

So I was trying to make a system that place the camera depending on where the hero is to better see the map, problem is with the camera movement. (Target movement)

This is in my map script

Code: (lua) [Select]
local function to_area(entity, callback)
  local movement = sol.movement.create("target")
  movement:set_target(camera:get_position_to_track(entity))
  movement:set_speed(50)
  movement:start(camera, function() if callback ~= nil then callback() end end)

  print(movement:get_speed())
end

function camera_to_area:on_activated()
  to_area(camera_spot) -- This should do it as it is aldo triggered when the minigame is about to start
end

function camera_to_hero:on_activated()
  local dir = hero:get_direction()
  if dir == 3 then
    to_area(hero, function() camera:start_tracking(hero) end)
  end
end

When I step on camera_to_area, the movement speed is the one I want, 50, but, if I step on camera_to_hero, the movement speed is 96, while I set the speed at 50, the function and the callback works, but speed looks kinda buggy.
I don't know if this is the right way to do but even with this configuration it should print 50, not 96
« Last Edit: August 02, 2016, 10:23:19 PM by MetalZelda »

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1186
    • View Profile
Re: movement:set/get_speed issue ?
« Reply #1 on: August 02, 2016, 10:18:47 PM »
I am not sure, maybe you should report a bug.