How can I combine a created image with a imagebutton to use it in a screen:

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
vitorfgd
Newbie
Posts: 5
Joined: Sun Feb 16, 2020 5:52 pm
Github: vitorfgd
Contact:

How can I combine a created image with a imagebutton to use it in a screen:

#1 Post by vitorfgd »

I'm developing a "hit the target" game and I've gone as far as randomly creating a new path for my target.

My problem right now is that I'm creating a image using Solid() and this needs to be a imagebutton that i can use inside a screen that will be called on a minigame, here's my code:

Code: Select all

scene bg room
image solid:
    Solid("#0000cc", xysize=(200, 200))
    xalign 0.0 yalign 0.0
    linear 1.0 xalign renpy.random.random() yalign renpy.random.random()
    linear 1.0 xalign renpy.random.random() yalign renpy.random.random()
    repeat

show solid
Later I'm going to move the random logic as a parameter for the screen but my problem right now is that I cannot use "solid" the image I created as an image for the imagebutton idle statement.

Is there a better way to do this?

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: How can I combine a created image with a imagebutton to use it in a screen:

#2 Post by gas »

EDIT.

No wait, did you tried

Code: Select all

imagebutton idle solid
?
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

vitorfgd
Newbie
Posts: 5
Joined: Sun Feb 16, 2020 5:52 pm
Github: vitorfgd
Contact:

Re: How can I combine a created image with a imagebutton to use it in a screen:

#3 Post by vitorfgd »

gas wrote: Sun Feb 16, 2020 7:10 pm EDIT.

No wait, did you tried

Code: Select all

imagebutton idle solid
?
Yeah I did, no matter where i put the image

Code: Select all

solid:
definition I always get

Code: Select all

name 'solid' not defined
.

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: How can I combine a created image with a imagebutton to use it in a screen:

#4 Post by gas »

I think the name 'solid' could be reserved, try another name.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: How can I combine a created image with a imagebutton to use it in a screen:

#5 Post by gas »

Sorry, you should also use quotes, like this.

Code: Select all

imagebutton idle "solid"
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

Post Reply

Who is online

Users browsing this forum: fufuffiero, Google [Bot]