[Solved]Create custom entity with script?

Started by zutokaza, May 04, 2017, 03:33:03 PM

Previous topic - Next topic
May 04, 2017, 03:33:03 PM Last Edit: May 05, 2017, 09:32:16 AM by zutokaza
I want to create a custom entity with script, but I am having trouble creating it. I want to create a new entity at the position of an already existing entity.

Code ( lua) Select
  map:create_custom_entity({
    name = "box",
    direction = 2,
    layer = 0,
    x = entity:get_position(),
    y = entity:get_position(),
    sprite = "entities/box",
    })
Solarus Works on ReactOS Opensource Windows OS

https://www.reactos.org/forum/viewtopic.php?f=2&t=14759&p=120616#p120616

This should work.

Code ( lua) Select
local xe,ye = entity:get_position()

  map:create_custom_entity({
    name = "box",
    direction = 2,
    layer = 0,
    width = 16,
    height = 16,
    x = xe,
    y = ye,
    sprite = "entities/box",
    })