Page 1 of 1

[solved] couldn't find file in image composite using images with effects applied

Posted: Sat Nov 11, 2017 8:52 pm
by ComputerArt.Club
My game uses a lot of the same assets over and over again, I used the colorize effect instead of adding extra images (so, for instance, I have a blue duck, red duck, yellow duck, orange duck etc. all made with the same image). I will use image composites for one section of the game, where I will take four separate items and then combine them with the background and use this composite to be used in an imagemap... it is part of a quiz that uses images for answers (this game is for kids). I spent a few hours on it yesterday, but I am experiencing a lot of problems.

Here is a simple example:
# From the header

image quiz = "quiz.png"

image purple duck = im.MatrixColor(
"wduck.png",
im.matrix.colorize("#000", "#af24d1"))

image quizp1 = im.Composite(
(720, 1280),
(0,0), "quiz.png",
(100, 700), "purple duck"
)
# more images will be combined in the final example, the image position is kinda random right now and just for testing.
# the game runs in portrait mode, thus 720x1280

# From the game - lines 122 and 123

show quizp1
"test"

Error message:
I'm sorry, but an uncaught exception occurred.

While loading <'Composite' (720, 1280) (0, 0) u'quiz.png' (100, 700) u'purple duck'>:
File "game/script.rpy", line 123, in script
"test"
File "renpy/common/000window.rpy", line 98, in _window_auto_callback
_window_show()
File "renpy/common/000window.rpy", line 60, in _window_show
renpy.with_statement(trans)
IOError: Couldn't find file 'purple duck'.

Suggestions?

Also, is im.composite different from LiveComposite or is livecomposite just older code?
I have already used im.composite with just .png files earlier in this project, but this section would make the game much bigger if I have to create new png files instead of using code.
I'm using Renpy 6.99.13

Thank you for your time and for reading this far :) I really appreciate it.

Re: couldn't find file in image composite using images with effects applied

Posted: Sat Nov 11, 2017 11:10 pm
by Divona
"im.Composite" is an old code, and if my memory serves me right it only takes image file. Use LiveComposite instead.

Code: Select all

image quizp1 = LiveComposite(
    (720, 1280),
    (0,0), "quiz.png",
    (100, 700), "purple duck"
)

Re: [solved] couldn't find file in image composite using images with effects applied

Posted: Sun Nov 12, 2017 11:02 am
by ComputerArt.Club
Thank you so much!

That worked like a charm! Eventually I was even able to animate in it (code below for anyone trying out something similar).

transform shinemove:
linear 1.0 xoffset 10
linear 1.0 xoffset -10
repeat

image shine = At("shine.png", shinemove)

image quizp1 = LiveComposite(
(720, 1280),
(0,0), "quiz.png",
(160,760), "shine",
(30, 900), "red duck",
(360, 900), "yellow duck",
(30, 570), "green duck",
(360, 570), "blue duck",
)

Just one big problem to solve and then this game will be 99% finished! Or at least the first complete version will be finished. :)