Inventory imagebutton moving help.

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
rereroa
Newbie
Posts: 4
Joined: Wed Feb 02, 2022 10:13 pm
Contact:

Inventory imagebutton moving help.

#1 Post by rereroa » Wed Feb 09, 2022 9:51 am

So, I'm currently trying to slide my imagebutton (which takes about half of the screen) to the side to show another.

Illustration included for a better idea:
IMG-1923.JPG
IMG-1924.JPG
Pink writings are just in for a better idea of movement; is not supposed to be in game.
IMG-1925.JPG
I want it to move it right/left with keys, so i tried

Code: Select all

key "K_RIGHT" action moveoutright
But it's not working (duh). So is there a way to make the imagebuttons move side to side?

Longer ver. of code

Code: Select all

label inventory_screen:
screen inventory_screen:
    key "K_RIGHT" action moveoutright

    imagebutton:
        idle "images/icons/items/item_cat.png"
        action If("scene01 = true, Jump('item_cat_ko'), NullAction()")
        # trying to make another character in another scene react to the same item.
        else: "scene02"
        	action Jump("item_cat_da")
        	
#Perhaps the same thing for dog? 

label item_cat_ko:
    k "Nice drawing."
   
label item_cat_da
	d "I don't really like that drawing."
	
	
label item_dog_ko:
    k "Is that an anteater?"
    
  label item_dog_da:
    k "Err.. Sure mate."
	
    
I'm very new to python and renpy, so any help will be greatly appreciated! Thanks in advance.

User avatar
Johan
Regular
Posts: 75
Joined: Mon Jan 14, 2019 5:58 pm
Projects: "And I saw the stars falling down..."
Organization: Novel & You
itch: johanww
Location: Perú
Discord: Johan#7444
Contact:

Re: Inventory imagebutton moving help.

#2 Post by Johan » Wed Feb 09, 2022 2:22 pm

first of all, those drawings are adorable!! cute uwu)/

second, do you want these images to appear at certain points during the script of the game (since you are talking about scenes),
or do you want the characters to react to the items of your inventory screen when clicked? I'm a bit confused about that.

Sorry, I'm not an expert on Ren'Py either but I do know some things ^^;;
My newsletter: dev cats!
Check it out here!

◤ And I saw the stars ★ falling down... ◢
Check the official DEMO!
.

rereroa
Newbie
Posts: 4
Joined: Wed Feb 02, 2022 10:13 pm
Contact:

Re: Inventory imagebutton moving help.

#3 Post by rereroa » Wed Feb 09, 2022 7:56 pm

Thanks so much! Haha
Johan wrote:
Wed Feb 09, 2022 2:22 pm
do you want these images to appear at certain points during the script of the game (since you are talking about scenes),
or do you want the characters to react to the items of your inventory screen when clicked? I'm a bit confused about that.
What I currently want to do is have an ace-attorney style inventory system where in the menu you can show the item to characters, and they will react to them.

I think I can manage doing the image appearing at certain points thing, but I can't seem to make
a) the imagebuttons move between items and
b) the imagebuttons make each character say their own little dialogue related to them.

Even though you say you're not an expert, I bet you know a whole lot more than me :D Thanks for trying to help!

User avatar
Johan
Regular
Posts: 75
Joined: Mon Jan 14, 2019 5:58 pm
Projects: "And I saw the stars falling down..."
Organization: Novel & You
itch: johanww
Location: Perú
Discord: Johan#7444
Contact:

Re: Inventory imagebutton moving help.

#4 Post by Johan » Fri Feb 11, 2022 4:53 pm

Ok! I actually had to try it out first before posting it ^^;;

First, there are codes out there for an inventory system with more details and all that explain better how to make it, like this one. Second, I found this thread referring to a PW system, check it out here. Maybe it's more to your liking? ^^

I'll be honest and say I don't know how to make characters react to a certain items (like in PW), but I did manage to do the "images that appear at certain points of the script" but I'm not sure if it'll be useful. I used this code as a reference. I made it like this:

Code: Select all

screen cutescreen():
    imagebutton:
        idle "images/your-image-here.png"
        xpos 300 #position
        ypos 200 #position
        action Return("1") #the dialogue
        at your_animation
    imagebutton:
        idle "images/your-image-here2.png"
        xpos 300 #position
        ypos 400 #position
        action Return("2") #the dialogue
        at your_animation
Then, in the script, I put:

Code: Select all

label start:
    character1 "Hey, look at this!"
    call screen cutescreen
    if _return == "1":
        character2 "I think the number 1 deserves all the hate."
    if _return == "2":
        character2 "I think the number 2 deserves all the praise. But I hate it too."
Btw, the animation needs to be done with ATL, something like this:

Code: Select all

transform your_animation:
    on idle:
        xpos 300
    on hover:
        ease 0.5 xpos 100
I'm... not sure how to make the exact animation you want though ^^;;;

Just in case, here's a link to the Imagebutton ren'py documentation.

Again, I'm not sure if it'll help xD but here it is anyway ^^
My newsletter: dev cats!
Check it out here!

◤ And I saw the stars ★ falling down... ◢
Check the official DEMO!
.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]