Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Ren'Py Achievements Framework

A (hopefully) easy way to add achievements to your Ren'Py game · By bobcgames

Achievement image

A topic by thief23 created 59 days ago Views: 64 Replies: 5
Viewing posts 1 to 2

How would I go about adding an image to the top right of the screen when you earn an achievement? I have my achievements defined but I cant quite figure out how to add the words up at the top either

Developer

Adding the description is easy if you use the sample screen (remember to set BOBCACHIEVEMENT_SCREEN_NAME):

screen bobcachievement_samplescreen(achievement_title, achievement_description):
    timer 5.0 action Hide("bobcachievement_samplescreen", transition=BOBCACHIEVEMENT_SCREEN_TRANSITION)
    vbox:
        xanchor 1.0 xpos 0.95 yanchor 0.0 ypos 0.05
        style_prefix "bobcachievement"
        text BOBCACHIEVEMENT_NOTIFY_PREFIX text_align 1.0 xalign 1.0
        text achievement_title text_align 1.0 xalign 1.0
        text achievement_description text_align 1.0 xalign 1.0

Unfortunately, adding an image is going to be harder because I didn't pass the achievement names to the screen, so you'd have to update that:

Change line 75 to

renpy.show_screen(BOBCACHIEVEMENT_SCREEN_NAME, achiname, BOBCACHIEVEMENTS_MAP[achiname][0], BOBCACHIEVEMENTS_MAP[achiname][1])

And then this screen (or something like it) should work:

screen bobcachievement_samplescreen(achiname, achievement_title, achievement_description):
    timer 5.0 action Hide("bobcachievement_samplescreen", transition=BOBCACHIEVEMENT_SCREEN_TRANSITION)
    hbox:
        xanchor 1.0 xpos 0.95 yanchor 0.0 ypos 0.05
        add "images/achievements/" + achiname + ".png"
        vbox:
            style_prefix "bobcachievement"
            text BOBCACHIEVEMENT_NOTIFY_PREFIX text_align 1.0 xalign 1.0
            text achievement_title text_align 1.0 xalign 1.0
            text achievement_description text_align 1.0 xalign 1.0

I figured out the image with a show command and just changed the xalign and yalign to be in the upper right corner for all achievements, I tried to do the code you replied with and it just keeps getting me exception errors but I think it is okay with just an image sliding in.

Developer

Well, glad you got it working for now :)

Thank you, I'm not too great at coding, but I was wondering if there's a way to customize the achievements screen on the main page when you click it, I would like to eventually have pictures and change the font a but for the actual page but wasn't sure if that was possible

Developer

Yeah... any customization is possible, but I think screen language is beyond the scope of this topic

I'd join the official Ren'Py discord and see if you can get some general pointers on screen language (or just google some tutorials)... the achievements screen is just a standard Ren'Py menu screen (similar to the Preferences or About screens) so you can customize it in any way you can customize those screens