Fußabdrücke im Spiel

  • #10, by dionousWednesday, 10. January 2018, 11:38 6 years ago
    that's a fantastic example indeed!

    Forum Fan

    246 Posts


  • #11, by esmeraldaWednesday, 10. January 2018, 12:37 6 years ago
    Thank you for the demo SimonS! It's great!
    It took me some time to understand the setting of the emission count (didn't realise you can leftclick to create another node), but now I got it working in a test-project.

    Key Killer

    508 Posts

  • #12, by afrlmeWednesday, 10. January 2018, 12:59 6 years ago
    Cheers for that Simon. Was really interesting to see. The particle system is really alien to me. Not really needed to use it so far, so I haven't spent much time figuring it out.

    Anyway, thanks again for the example. Both the particle system example & script will surely be useful as reference to a lot of people; & not just for creating footsteps.

    Imperator

    7278 Posts

  • #13, by MachtnixWednesday, 10. January 2018, 14:40 6 years ago
    Is it only possible with R 5?

    Thread Captain

    1097 Posts

  • #14, by SimonSWednesday, 10. January 2018, 15:22 6 years ago
    V5 only.

    Thread Captain

    1580 Posts

  • #15, by MachtnixWednesday, 10. January 2018, 15:57 6 years ago
    Why? Because the features aren't available in 4.2.5? I didn't try particles very often (only for snow of dandelions and some laser beams - it seems not very userfriendly to me), but setting the emitter to a position should be possible with Lua in 4.2.5? I can't use R5.

    Edit: all functions you need are available in 4.2.5 (emitter position, particle direction from point), but remarked as not scriptable. I don't know what happens if I will edit them, I think it's on my own risk... wink

    Thread Captain

    1097 Posts

  • #16, by SimonSWednesday, 10. January 2018, 22:48 6 years ago
    The particle system in V5 and V4 are not the same, V5 has a complete rework with much more possibilities.

    Thread Captain

    1580 Posts

  • #17, by sebastianThursday, 11. January 2018, 00:33 6 years ago
    Very nice script. 
    I tried to put a character on fire (still named footstep). 
    It works also well. But it seems that i cant control the y-coordinate of the object to let the fire particle render above the character (y+1) but also always behind objects the character is standing behind.

    function particleLoop()
      local p = graphics.getParticles(game.CurrentScene.Objects.footstep)
      local c = game.CurrentCharacter
      local dir = (game.CurrentCharacter.Direction - 90) / 180 * 3.1415
      game.CurrentScene.Objects.footstep.Center = game.CurrentCharacter.Position.y +1
      p.rotation = {0.0, dir, 0.0, dir}
      p.center = {c.Position.x, c.Position.y}
      p.size = {0.0, c.Size*0.5, 0.0, c.Size*0.5}
      print(game.CurrentScene.Objects.footstep.Center)
    end
    
    registerEventHandler("mainLoop", "particleLoop") 

    (rotation is still in it, but not necceccary for my fire...thats what the emitter will handle by itself)

    The console logs that the object center is updated, but the particles stay always on the same initial layer which is set at the objects center number. So it seems that the NEW emitted particles dont get affected by the Y-setting

    any ideas?

    Thread Captain

    2346 Posts

  • #18, by AlexThursday, 11. January 2018, 13:59 6 years ago
    The scene objects are drawn in the same order as they appear in the scene object list. The y-coordinate is only used to determine if the character is drawn in front or behind the object. I don't think it's currently possible to change the order of the object.

    Great Poster

    378 Posts

  • #19, by sebastianThursday, 11. January 2018, 17:33 6 years ago
    it seems that when i also add an object image, that the particles get shown in front or behind the character basing on the image y location. so maybe itll update properly when i move (also) the whole object and use a transparent image... 

    Thread Captain

    2346 Posts

  • #20, by afrlmeThursday, 11. January 2018, 17:52 6 years ago
    I'm not 100% sure, but if you offset the object it should also adjust the object center value with it. Start object position at 0, 0 then you can have it offset to the current characters position or whatever you want.

    Imperator

    7278 Posts