Override background

Learn here how to create and use plugins.

Moderator: KoalaGuy

Post Reply
User avatar
Lobby
Developer
Reactions:
Posts: 2909
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Override background

Post by Lobby » Thu Nov 30, 2017 21:55

Screenshot_20171130-204326.png
Hi, as proposed here it's now possible to change the color of the background. The background basically persists out of a tile frame that's drawn over and over again. Unfortunately it's a bit less simple, as there are some special cases due to elevated coast lines. As a result you have to provide 3 frames to override the background:
frames_explain.png
frames_explain.png (1.95 KiB) Viewed 388 times
Frames b and c are used to draw the background above water at the edges. This is crucial as ocean is drawn everywhere and has to be overdrawn at the correct positions.

The the used original frames look like:
frames_orig.png
frames_orig.png (408 Bytes) Viewed 388 times
This sample replaces the background with a black one:
frames.png
frames.png (381 Bytes) Viewed 388 times
For your own background, just recolor this image :)

The code to override the background looks like:

Code: Select all

[
  {
    "override":true,
    "id":"$anim_blank00",
    "type":"animation",
    "frames":[
      {"bmp":"frames.png","w":32,"h":16,"handle y":8},
      {"bmp":"frames.png","x":32,"w":16,"h":16,"handle y":8},
      {"bmp":"frames.png","x":48,"w":16,"h":16,"handle x":-16,"handle y":8}
    ]
  }
]
As you might notice it is also responsible for setting the handles properly. I recommend to just reuse this code instead of writing it on your own.
Attachments
own_background.json
(307 Bytes) Downloaded 14 times
own_background.zip
(1.58 KiB) Downloaded 20 times
...Have a nice stay

User avatar
mdk_813
Inhabitant of a Country
Reactions:
Posts: 841
Joined: Fri Dec 16, 2016 2:38
Location: Germany
Plugins: Show

Re: [383]Override background

Post by mdk_813 » Thu Nov 30, 2017 22:15

@Lobby
Thank you! :thumbsup:
My Plugins: Link

PLEASE NOTE: My plugins are not open source! So, ask me first before altering and republishing any of my plugins!

User avatar
KoalaGuy
TheoTown Veteran
Reactions:
Posts: 6422
Joined: Mon Mar 06, 2017 21:45
Location: Koalafornia
Plugins: Show
Version: Beta
Phone: SamsungGalaxyJ5 2017
Contact:

Re: [383]Override background

Post by KoalaGuy » Thu Nov 30, 2017 22:55

Nice!

You can also see it in action here :) :
https://theotown.com/forum/viewtopic.ph ... 699#p68699

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1587
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone: Moto Z Force Droid

Re: [383]Override background

Post by KINGTUT10101 » Fri Dec 01, 2017 2:01

Is it possible to have multiple frames for the background?

User avatar
Lobby
Developer
Reactions:
Posts: 2909
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: [383]Override background

Post by Lobby » Fri Dec 01, 2017 11:10

no
...Have a nice stay

BruceWillis24
Villager
Reactions:
Posts: 21
Joined: Sun Aug 09, 2015 0:42
Location: Grand Rapids Michigan
Plugins: Show
Version: Beta

Re: [383]Override background

Post by BruceWillis24 » Sun Dec 24, 2017 18:57

@Lobby I really like the brown background in the first image you posted in this topic. Could you post that as well?

Thank you in advance!

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 5487
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: [383]Override background

Post by CommanderABab » Sun Dec 24, 2017 19:23

Screenshot_20171224-115241.jpg
There it is! :)
466466Currently using beta 466. 466 What's new? :)
Plugin image prefetch!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Bearbear65
Inhabitant of a Universe
Reactions:
Posts: 4169
Joined: Fri Feb 10, 2017 14:53
Location: Earth
Plugins: Show
Version: Beta
Phone: Asus zenpad 10

Re: [383]Override background

Post by Bearbear65 » Tue Dec 26, 2017 1:45

You can change the background
In winter by using "frames winter":[{}],
Something i discovered yesterday
ImageJust my opinion

User avatar
Lobby
Developer
Reactions:
Posts: 2909
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: [383]Override background

Post by Lobby » Tue Dec 26, 2017 1:45

Yes, you can do that everywhere where you have to provide frames :)
...Have a nice stay

User avatar
Bearbear65
Inhabitant of a Universe
Reactions:
Posts: 4169
Joined: Fri Feb 10, 2017 14:53
Location: Earth
Plugins: Show
Version: Beta
Phone: Asus zenpad 10

Re: [383]Override background

Post by Bearbear65 » Tue Dec 26, 2017 1:50

IMG_20171226_085022.jpg
ImageJust my opinion

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest