Dark Inside Me, psychological horror adventure game - Trailer & Gameplays

  • #10, by AkcayKaraazmakWednesday, 17. December 2014, 21:09 10 years ago
    Ufff Simon smile) How we could use this script, it complicated bro ..? smile

    Great Poster

    440 Posts


  • #11, by SimonSWednesday, 17. December 2014, 21:46 10 years ago
    It's doing its job on its own. Just paste it as definition script.

    Thread Captain

    1582 Posts

  • #12, by AkcayKaraazmakWednesday, 17. December 2014, 21:55 10 years ago
    Aa really, will check it soon. Thank you bro!

    Great Poster

    440 Posts

  • #13, by MachtnixWednesday, 17. December 2014, 22:35 10 years ago
    I played a little around with the old script. That can be easily targeted onto 3D.

    smt_turnactive = false
    smt_direction = game.CurrentCharacter.Direction
    smt_dest = game.CurrentCharacter.Position
    smt_destobj = game.CurrentCharacter.DestinationObject
    
    function angleDist(a,b)
    return math.min(math.min( math.abs(a + 360 - b), math.abs(a - 360 - b)), math.abs(a - b))
    end
    
    function smoothTurningMainLoop()
    local newstate = game.CurrentCharacter.AnimState
    local newdir = game.CurrentCharacter.Direction
    local c = game.CurrentCharacter
    if smt_turnactive and newdir == smt_direction then
    c.DestinationObject = smt_destobj
    c.Destination = smt_dest
    smt_turnactive = false
    end
    if not smt_turnactive and smt_direction~=newdir then
    local turn = false
    if newstate == eWalkAnim and smt_state ~= eWalkAnim then
    smt_dest = c.Destination
    c.Destination = c.Position
    smt_destobj = c.DestinationObject
    turn = true
    end
    if newstate ~= eWalkAnim and smt_state == eWalkAnim then
    turn = true
    end
    if turn then
    smt_turnactive = true
    local start = smt_direction
    if math.abs(newdir - smt_direction - 360) < math.abs(newdir - smt_direction) and math.abs(newdir - smt_direction - 360) < math.abs(newdir - smt_direction +360) then
                            start = smt_direction + 360
    elseif math.abs(newdir - smt_direction + 360) < math.abs(newdir - smt_direction) then
    start = smt_direction - 360
    end
    game.CurrentCharacter.Direction = start
    game.CurrentCharacter:to(angleDist(smt_direction, newdir) * 5, {Direction = newdir})
    end
    end
    smt_direction = newdir
    [b]smt_state = newstarte[/b]
    end
    
    registerEventHandler("mainLoop", "smoothTurningMainLoop")
    

    Is this newstarte-thing (line 43) correct?

    And: Can I use this script for 2D-characters (png-frames) Vis is originally making for? Whrere I put the prerendered turning animation into the script?

    Thx

    Machtnix

    Thread Captain

    1097 Posts

  • #14, by SimonSWednesday, 17. December 2014, 22:42 10 years ago
    In fact you can completely remove the line, but it will evaluate to nil = nil, so no problem.
    This script just smoothly changes the angle of the character in between, so more a small fix up. The other script is in another thread. If you have enogh directions you can see the effect, but even with 8 it is better than no turning.

    Thread Captain

    1582 Posts

  • #15, by MachtnixWednesday, 17. December 2014, 22:49 10 years ago
    Thank you. I was irritated about the "newstarte" - it isn't a "start" neither a "state". ;-)
    I want a smooth turn about 180° - my character moves only left to right and reverse. So it looks silly turning immediately from left to right... ;-)

    Machtnix

    Thread Captain

    1097 Posts

  • #16, by afrlmeWednesday, 17. December 2014, 23:48 10 years ago
    Like I said: you only really need a single frame per direction for turning to make it look similar to Broken Sword style turning. I would recommend adding 16 directions for turning to make it super smooth but that might be a bit overkill if your game is 1080p & the file-size per each frame is quite large - although you can reduce file-size by replacing all instances of png in the editor with webP format, which is significantly smaller in size & the quality is pretty much the same as the png; well providing you export with quality @ 100% or lossless.

    Imperator

    7283 Posts

  • #17, by MachtnixThursday, 18. December 2014, 00:32 10 years ago
    Like I said: you only really need a single frame per direction for turning to make it look similar to Broken Sword style turning.

    I believe you (I want to use only 4 frames between left and right), but I don't know how it works. It's the same as in my other thread http://www.visionaire-studio.net/forum/thread/ein-und-aussch.... All pose animations are looped so fitting an extra animation at the start or at the end doesn't work that simple.

    Machtnix

    Thread Captain

    1097 Posts

  • #18, by afrlmeThursday, 18. December 2014, 00:45 10 years ago
    You would need to query before character starts walking if direction needs to change. Simon's script above does that to a certain effect. The script I've been working on uses individual animations instead & is somewhat more precise in calculating closest rotation because I calculate using ranges to return rounded off angles which get added to a temporary table. Unfortunately my script isn't ready yet.

    Imperator

    7283 Posts

  • #19, by MachtnixThursday, 18. December 2014, 01:13 10 years ago
    OK. I don't understand the script, but I try to use it. Look what happens. Thx.

    back to thread: the horror game looks very nice. At the moment (but not now) I am playing "Bioshock" and I think it looks similar sometimes. I remember "Zork" and "Bioshock infinite" which have some strange medical laboratories too...

    Machtnix

    Thread Captain

    1097 Posts

  • #20, by AkcayKaraazmakThursday, 18. December 2014, 14:47 10 years ago
    @Simon, hey mate it worked very well, thank you realy. But how I may I use the character'a 3d turning data frames when characters is turning. Because now its just turning on its pivot, without character real turn animation.
    Lets say I have the walking animation 0-20 and turn is 21-30. So how I can play the frames 21-30 when the character turns with your script?

    Thank you very much!!!

    Great Poster

    440 Posts