How does pos works?

Plug-in related stuff can be discussed here.

Moderators: Plugin Moderators, Scenario Moderators

User avatar
yusuf8a684

How does pos works?

#1

Post by yusuf8a684 »

how does pos works?
I tried to add night texture to a vehicle but;

-Night animation was always on all day and night
-Animation was spinning

+At least it was fitting to it's place

I can give the plugin file to the trusted ones to test it or help me. It has a special code in it, that's why I can't put it here

User avatar
JustAnyone
Developer
Posts: 3595
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: How does pos works?

#2

Post by JustAnyone »

My, as an expert, reply - how it works I do not know. All I know is that it works and that you'll need a lot of trial and error.

User avatar
CommanderABab
AB
Posts: 11264
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: How does pos works?

#3

Post by CommanderABab »

Code: Select all

{"id":"$abbcwhite00",  //defining the animations
    "type":"animation",
    "light":true,
    "light switching":false,
    "frames":[ {"bmp":"whitepixel.png"},   {"bmp":"whitepixel.png"}, {"bmp":"whitepixel.png"}, {"bmp":"whitepixel.png"}    ],
    "v2":true 
   },
   {"id":"$abbcred00",
    "type":"animation",
    "light":true,
    "light switching":false,
    "frames":[ {"bmp":"redpixel.png"}, {"bmp":"redpixel.png"},   {"bmp":"redpixel.png"},  {"bmp":"redpixel.png"} ],
    "v2":true 
   }, 
   
   {
    "id":"$bcanimationcalltemplate00",  //template of everything but the frames for each of three cars
    "type":"template",
    "animation": [// the pos numbers here are not all correct :/
      {
        "id": "$abbcwhite00",
        "pos": [10, 8, 11, -3, 1, 0, 1, 3],  //xy pos of the light
        "frames": [0, 3]  //which frames of the car this applies to
      },
      {
        "id": "$abbcwhite00",
        "pos": [15, 2, 15, 0, 6, -2, 5, 5],
        "frames": [0, 3]
      },
      {
        "id": "$abbcred00",
        "pos": [1, -6, 11, -4, 12, -2, 11, 9],
        "frames": [1, 2]
      },
      {
        "id": "$abbcred00",
        "pos": [6, -9, 5, -2, 15, -4, 15, -7],
        "frames": [1, 2]
      }
    ],
   "capacity":10,
   "flag normal":true, 
   "flag user2":true,
   "speed":0.5,
   "v2":true 
  },
    
  { 
    "id":"$bigcomcarplugin00", // using the template in the cars
    "type":"car", 
    "frames":[ 
      {"bmp":"bigcomcars.png","w":15,"h":10,"count":4} 
    ], 
   "template":"$bcanimationcalltemplate00"
   
  } ,
  
  { 
    "id":"$bigrescarplugin00", 
    "type":"car", 
    "frames":[ 
      {"bmp":"bigrescars.png","w":15,"h":10,"count":4} 
    ], 
    "template":"$bcanimationcalltemplate00"
  } ,
  
  
  { 
    "id":"$bigindcarplugin00", 
    "type":"car", 
    "frames":[ 
      {"bmp":"bigindustcars.png","w":15,"h":10,"count":4} 
    ], 
    "template":"$bcanimationcalltemplate00"
  } ,
bigcomcars.png
bigcomcars.png (1.03 KiB) Viewed 3980 times
bigindustcars.png
bigindustcars.png (1.04 KiB) Viewed 3980 times
bigrescars.png
bigrescars.png (1.08 KiB) Viewed 3980 times

Code: Select all

        "pos": [15, 2, 15, 0, 6, -2, 5, 5],
        "frames": [0, 3]
The numbers in this array for example are where the white light pixels will be placed on graphic frames 0 and 3

User avatar
yusuf8a684

Re: How does pos works?

#4

Post by yusuf8a684 »

Thanks commanderABab. I will try those

User avatar
CommanderABab
AB
Posts: 11264
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: How does pos works?

#5

Post by CommanderABab »

Remember, they are not all in the right place. :/
And it's hard to debug, when they are all moving around. :)

User avatar
yusuf8a684

Re: How does pos works?

#6

Post by yusuf8a684 »

I used the code you gave me but it didn't work

Code: Select all

...{
    "frames": [
      {
        "bmp": "TCDD_modern_suburban_nightA.png"
      },
      {
        "bmp": "TCDD_modern_suburban_nightB.png"
      },
      {
        "bmp": "TCDD_modern_suburban_nightC.png"
      },
      {
        "bmp": "TCDD_modern_suburban_nightD.png"
      }
    ],
    "id": "$TCDD_modern_suburban_night",
    "type": "animation",
    "light": true,
    "light switching": false,
    "v2": true
  },
  {
    "animation": [
      {
        "id": "$TCDD_modern_suburban_night",
        "pos": [
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0
        ],
        "frames": [
          0
        ]
      },
      {
        "id": "$TCDD_modern_suburban_night",
        "pos": [
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0
        ],
        "frames": [
          1
        ]
      },
      {
        "id": "$TCDD_modern_suburban_night",
        "pos": [
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0
        ],
        "frames": [
          2
        ]
      },
      {
        "id": "$TCDD_modern_suburban_night",
        "pos": [
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0
        ],
        "frames": [
          3
        ]
      }
    ],
    "id": "$TCDD_modern_suburban_night_template",
    "type": "template",
    "flag normal": false,
    "flag train": true,
    "v2": true,
    "capacity": 10,
    "speed": 1
  },
  {
    "author": "yusuf8a684",
    "frames": [
      {
        "bmp": "TCDD_modern_suburban.png",
        "count": 4,
        "h": 19,
        "w": 20
      }
    ],
    "id": "TCDD_modern_suburban_vagon",
    "type": "car",
    "template": "$TCDD_modern_suburban_night_template",
    "flag normal": false,
    "flag train": true,
    "v2": true
  }... 
This is how it is like


User avatar
CommanderABab
AB
Posts: 11264
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: How does pos works?

#7

Post by CommanderABab »

That's because multiple frames in one animation definition are all drawn in the order given.
Screenshot_20200131-112310.jpg
You should just provide one side for four animations, then call those as required.

User avatar
yusuf8a684

Re: How does pos works?

#8

Post by yusuf8a684 »

Oh, soo I need to write own templates for each animation. Thanks for help ABab :)

User avatar
yusuf8a684

Re: How does pos works?

#9

Post by yusuf8a684 »

But, what about animations working all day and night?

User avatar
CommanderABab
AB
Posts: 11264
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: How does pos works?

#10

Post by CommanderABab »

yusuf8a684 wrote:
31 Jan 2020, 20:07
But, what about animations working all day and night?
Put "light switching":true if you just want them to show at night.

User avatar
yusuf8a684

Re: How does pos works?

#11

Post by yusuf8a684 »

Every animation is fitting now! Thanks again but I made all light switching true but lights are open all day and night still

Post Reply Previous topicNext topic

Return to “Plug-In Discussion”