Entity beeing shown up the player?

Place to get help with not working mods / modding interface.
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Entity beeing shown up the player?

Post by ficolas »

Image

Is there any way the player isnt seen when the the entity is under it? so the player would be under the entity instead.
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Entity beeing shown up the player?

Post by rk84 »

picture.priority = "extra-high" mayby?
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Entity beeing shown up the player?

Post by ficolas »

rk84 wrote:picture.priority = "extra-high" mayby?
No :(

Code: Select all

  {
    type= "container",
    name= "rocket-1",
    flags= {"placeable-neutral", "player-creation"},
    collision_box= {{-1.9, 2.4}, {1.9, 5.4}},
    selection_box= {{-2, -5.5}, {2, 5.5}},
    minable= { hardness= 999, mining_time= 9999, result= "rocket-1" },
    max_health= 50,
    drawing_position= {0.7, 0.12},
	icon="__F-mod__/resources/icons/rocket.png",
	inventory_size=104,
    picture=
    {
      filename= "__F-mod__/resources/entity/rocket/one.png",
      width = 160,
      height = 340,
      priority = "extra-high",
  }
  },
kovarex
Factorio Staff
Factorio Staff
Posts: 8292
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Entity beeing shown up the player?

Post by kovarex »

The order of the pictures is determined primarily by layers (container and player have same layer, so it is ok).
Second condition is the y coordinate of the position of the entity, if you want the rocket to be above the player in this situation, you need to move it's location closer to it's base.
You can do it by moving the collision down and drawing position up.
(Look how trees are made)
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Entity beeing shown up the player?

Post by ficolas »

So how should it look like? the colision box is alredy down, and changing the drawing position does nothing :S

I think it was removed in 0.?
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Entity beeing shown up the player?

Post by FreeER »

probably replaced with the shift option:

Code: Select all

     pictures =
    {
      {
        filename = "__base__/graphics/entity/big-tree/big-tree-01.png",
        priority = "extra-high",
        width = 155,
        height = 118,
        shift = {1.1, -1}
      },
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
kovarex
Factorio Staff
Factorio Staff
Posts: 8292
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Entity beeing shown up the player?

Post by kovarex »

Yes, shift is used everywhere (it is more general, and self-contained, mainly for entities with more sprites/animations).

Your collision box definition is:

Code: Select all

collision_box= {{-1.9, 2.4}, {1.9, 5.4}},
This means, the center is in the upper part of the object, it is not good.
You should make the collision box more like this:

Code: Select all

collision_box= {{-1.9, 6.8}, {1.9, 1.0}},
So the center of the object is on the place where the object touches the ground.
SilverWarior
Filter Inserter
Filter Inserter
Posts: 559
Joined: Mon Mar 04, 2013 9:23 am
Contact:

Re: Entity beeing shown up the player?

Post by SilverWarior »

Factoprio is ment to be use topdown view so having something similar as in isometric view isn't easily done.

I would suggest that you split the entity picture into two parts:
- bottom part is show ans every other entity and is by default rendered behind the player. Colision box has same dimension as botom part
- top part has different Z order so it is always shown on top of other bottom parts or player character.
MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: Entity beeing shown up the player?

Post by MF- »

SilverWarior wrote:Factoprio is ment to be use topdown view so having something similar as in isometric view isn't easily done.

I would suggest that you split the entity picture into two parts:
- bottom part is show ans every other entity and is by default rendered behind the player. Colision box has same dimension as botom part
- top part has different Z order so it is always shown on top of other bottom parts or player character.
If the bottom part is shoter than the character, it won't work out well :P
Sounds like a hack that could work, true, but why? the top part should not have a collision box, which should be only at the place where it touches the ground.
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Entity beeing shown up the player?

Post by rk84 »

kovarex wrote:Yes, shift is used everywhere (it is more general, and self-contained, mainly for entities with more sprites/animations).

Your collision box definition is:

Code: Select all

collision_box= {{-1.9, 2.4}, {1.9, 5.4}},
This means, the center is in the upper part of the object, it is not good.
You should make the collision box more like this:

Code: Select all

collision_box= {{-1.9, 6.8}, {1.9, 1.0}},
So the center of the object is on the place where the object touches the ground.
If that uses the same topleft-bottomright logic as findentities then top is lower then bottom? :? (in coords negative y axel goes up)

I though it would be more like this? (box centere around entity position so player does not loose his head in front of it)

Code: Select all

collision_box= {{-1.9, -1.5}, {1.9, 1.5}},
And then Shift the picture up 3.8125 tiles?
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: Entity beeing shown up the player?

Post by MF- »

negative on Y usually means UP in 2D. Coords are taken from the topleft corner for some historical reasons.
(That is NOT related to factorio. I have no idea how it works there)
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Entity beeing shown up the player?

Post by ficolas »

I cant figure out how to do it...
If I move the colision box down, then the colision box will be out, and if I shift it down, then it will be the same...
kovarex
Factorio Staff
Factorio Staff
Posts: 8292
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Entity beeing shown up the player?

Post by kovarex »

ficolas wrote:I cant figure out how to do it...
If I move the colision box down, then the colision box will be out, and if I shift it down, then it will be the same...
This is the tree:

Code: Select all

collision_box = {{-0.4, -0.4}, {0.4, 0.4}}, -- small around the actual position of the entity
...
pictures:
{
 ...
  {
        filename = "__base__/graphics/entity/tree/tree-a01.png",
        priority = "extra-high",
        width = 84,
        height = 64,
        shift = {0.5, -0.8} -- Picture shifted up (left shift is because of the shadow)
      },
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Entity beeing shown up the player?

Post by ficolas »

I have this problem again, do the priority have something to do with it?
This time I want it to be shown the lowest, below everything, but I cant even changing the hitbox (the hitbox should be 0 so...)
kovarex
Factorio Staff
Factorio Staff
Posts: 8292
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Entity beeing shown up the player?

Post by kovarex »

The priority has nothing to do with that.
The priority just specifies internal order of sprites in the atlas, the goal is to have the most used sprites in the first atlas always, as switching from atlas to atlas slows down the render method.
So big sprites or sprites not used so often should never have the highest priority.

Could you provide example code?
Post Reply

Return to “Modding help”