Ren'Py masturbation movements in renpy

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,040
3,135
everything works just fine except for a couple of things like adding sound and making go a little bit faster
when I hold down or press the up/down keys it restarts the sound/music track

is there a way to make it go faster?

it goes from 0 to 30 then to 0

outhouse_ryan_handjob_M00.png outhouse_ryan_handjob_M30.png

class:
Python:
class BATIONS(object):
        def __init__(self, name):
            self.name = name

        @property
        def mastur_image(self):
            global masturbation_move
            mtr = "masturbation/{}_{}.png".format(self.name, str(masturbation_move))


            if renpy.loadable(mtr):
                return mtr
            else:
                return "avatar/empty.png"
screen: Just updated
Python:
screen masturbating_button:

    if ryan_lust > 340:
        imagebutton:
            xalign 1.0
            yalign 1.0
            idle "cum_button"
            hover "cum_button"
            action Show("masturbation_move")
    elif ryan_lust < 340:
        pass


image cum_button:
    "images/lust/penis_timer_cum_button.png"
    pause 1.0
    "images/lust/penis_timer_cum_button2.png"
    pause 1.0
    repeat


screen masturbation_move():
    if masturbation_move < 30:
        key 'repeat_K_UP':
            action SetVariable('masturbation_move', masturbation_move + 1)
        key 'K_UP':
            action SetVariable('ryan_lust', ryan_lust + 5)
    if masturbation_move > 0:
        key 'repeat_K_DOWN':
            action SetVariable('masturbation_move', masturbation_move - 1)
        key 'K_DOWN':
            action SetVariable('ryan_lust', ryan_lust + 5)


    if ryan_lust == 500:
        timer 0.001 action Hide("masturbation_move"), Call("masturb")

    for q in MSTU:
        add q.mastur_image
label
Python:
label masturb:
    show mas_icon2
    $ ryan_lust -= 500
    $ renpy.pause(3.0, hard=True)
    hide mas_icon2
    return


image mas_icon2:
    "images/outhouse_ryan_handjob_M_cum1.png"
    pause 1.0
    "images/outhouse_ryan_handjob_M_cum2.png"
    pause 1.0
    "images/outhouse_ryan_handjob_M_cum3.png"
    pause 1.0
    "images/outhouse_ryan_handjob_M_cum4.png"
    pause 1.0
    "images/outhouse_ryan_handjob_M_cum5.png"
    pause 1.0
    "images/outhouse_ryan_handjob_M_cum6.png"
    pause 1.0
 
Last edited:

Saki_Sliz

Well-Known Member
May 3, 2018
1,403
1,004
If I understand correctly, the remaining thing you need help with is controlling the animation speed?

Currently it looks to be just controlled by how fast 'repeat_K_UP' and 'repeat_K_DOWN' are able to poll. I haven't played with key controls yet so I don't know any technical aspects about controlling poll rates to control the game's animation speed. But a simple way to increase animation speed without dealing with technical stuff to instead of increasing by a single frame masturbation_move + 1, you could increase by 2 or 3, but if that's too fast, I think tehcnically you could get away with fractional increases so long as the number gets rounded doing the if statements (may want to look into dynamic images and conditional switch statements... as Flavor69 and Anne have been reminding me frequently today), and the min/max numbers would have to be <= or >= not just == to account for over shoot. The issue with non whole numbers is that it makes the animation 'uneven' basicaly move 1 frame, then 2 frames, then frame 4 (skipping a frame) causing a jittering effect. Hence why you most likely need some way to control screen/sceen poll rate, as it would avoid this issue and keep the animation smooth, but I haven't had to look into keys and this 'repeat' feature yet, so I don't know if that is even possible in renpy.
 

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,040
3,135
If I understand correctly, the remaining thing you need help with is controlling the animation speed?

Currently it looks to be just controlled by how fast 'repeat_K_UP' and 'repeat_K_DOWN' are able to poll. I haven't played with key controls yet so I don't know any technical aspects about controlling poll rates to control the game's animation speed. But a simple way to increase animation speed without dealing with technical stuff to instead of increasing by a single frame masturbation_move + 1, you could increase by 2 or 3, but if that's too fast, I think tehcnically you could get away with fractional increases so long as the number gets rounded doing the if statements (may want to look into dynamic images and conditional switch statements... as Flavor69 and Anne have been reminding me frequently today), and the min/max numbers would have to be <= or >= not just == to account for over shoot. The issue with non whole numbers is that it makes the animation 'uneven' basicaly move 1 frame, then 2 frames, then frame 4 (skipping a frame) causing a jittering effect. Hence why you most likely need some way to control screen/sceen poll rate, as it would avoid this issue and keep the animation smooth, but I haven't had to look into keys and this 'repeat' feature yet, so I don't know if that is even possible in renpy.
key + repeat is to when you hold down a key if the key is just a key it's a single press


if you look at this part then you would know that 'repeat_K_UP' and 'repeat_K_DOWN' control this part and changing this masturbation_move + 1 to masturbation_move + 2 will skip a image
Python:
 if masturbation_move == 0:
        add "images/outhouse_ryan_handjob_M00.png"
    if masturbation_move == 1:
        add "images/outhouse_ryan_handjob_M01.png"
    if masturbation_move == 2:
        add "images/outhouse_ryan_handjob_M02.png"
    if masturbation_move == 3:
        add "images/outhouse_ryan_handjob_M03.png"
    if masturbation_move == 4:
        add "images/outhouse_ryan_handjob_M04.png"
    if masturbation_move == 5:
        add "images/outhouse_ryan_handjob_M05.png"
    if masturbation_move == 6:
        add "images/outhouse_ryan_handjob_M06.png"
    if masturbation_move == 7:
        add "images/outhouse_ryan_handjob_M07.png"
    if masturbation_move == 8:
        add "images/outhouse_ryan_handjob_M08.png"
    if masturbation_move == 9:
        add "images/outhouse_ryan_handjob_M09.png"
    if masturbation_move == 10:
        add "images/outhouse_ryan_handjob_M10.png"
    if masturbation_move == 11:
        add "images/outhouse_ryan_handjob_M11.png"
    if masturbation_move == 12:
        add "images/outhouse_ryan_handjob_M12.png"
    if masturbation_move == 13:
        add "images/outhouse_ryan_handjob_M13.png"
    if masturbation_move == 14:
        add "images/outhouse_ryan_handjob_M14.png"
    if masturbation_move == 15:
        add "images/outhouse_ryan_handjob_M15.png"
    if masturbation_move == 16:
        add "images/outhouse_ryan_handjob_M16.png"
    if masturbation_move == 17:
        add "images/outhouse_ryan_handjob_M17.png"
    if masturbation_move == 18:
        add "images/outhouse_ryan_handjob_M18.png"
    if masturbation_move == 19:
        add "images/outhouse_ryan_handjob_M19.png"
    if masturbation_move == 20:
        add "images/outhouse_ryan_handjob_M20.png"
    if masturbation_move == 21:
        add "images/outhouse_ryan_handjob_M21.png"
    if masturbation_move == 22:
        add "images/outhouse_ryan_handjob_M22.png"
    if masturbation_move == 23:
        add "images/outhouse_ryan_handjob_M23.png"
    if masturbation_move == 24:
        add "images/outhouse_ryan_handjob_M24.png"
    if masturbation_move == 25:
        add "images/outhouse_ryan_handjob_M25.png"
    if masturbation_move == 26:
        add "images/outhouse_ryan_handjob_M26.png"
    if masturbation_move == 27:
        add "images/outhouse_ryan_handjob_M27.png"
    if masturbation_move == 28:
        add "images/outhouse_ryan_handjob_M28.png"
    if masturbation_move == 29:
        add "images/outhouse_ryan_handjob_M29.png"
    if masturbation_move == 30:
        add "images/outhouse_ryan_handjob_M30.png"
i have done it in rpgm but renpy is a little bit different

Python:
◆Show Picture:#1, outhouse_ryan_handjob_M0, Upper Left (150,0), (80%,60%), 255, Normal
◆If:Button [Up] is being pressed
  ◆If:masturbation_speed = 2
    ◆Control Variables:#0007 masturbation_move += 2
    ◆
  :Else
    ◆If:masturbation_speed = 3
      ◆Control Variables:#0007 masturbation_move += 3
      ◆
    :Else
      ◆Control Variables:#0007 masturbation_move += 1
      ◆
    :End
    ◆
  :End
  ◆If:masturbation_move > 30
    ◆Control Variables:#0007 masturbation_move = 30
    ◆If:masturbation_move = 30
      ◆Control Variables:#0004 ryan lust += 1
      ◆
    :End
    ◆
  :End
  ◆
:End
◆If:Button [Down] is being pressed
  ◆If:masturbation_speed = 2
    ◆Control Variables:#0007 masturbation_move -= 2
    ◆
  :Else
    ◆If:masturbation_speed = 3
      ◆Control Variables:#0007 masturbation_move -= 3
      ◆
    :Else
      ◆Control Variables:#0007 masturbation_move -= 1
      ◆
    :End
    ◆
  :End
  ◆If:masturbation_move < 0
    ◆Control Variables:#0007 masturbation_move = 0
    ◆
  :End
  ◆
:End
◆If:masturbation_move > 0
  ◆Show Picture:#1, outhouse_ryan_handjob_M0, Upper Left (150,0), (80%,60%), 255, Normal
  ◆If:masturbation_move > 3
    ◆Show Picture:#1, outhouse_ryan_handjob_M1, Upper Left (150,0), (80%,60%), 255, Normal
    ◆If:masturbation_move > 6
      ◆Show Picture:#1, outhouse_ryan_handjob_M2, Upper Left (150,0), (80%,60%), 255, Normal
      ◆If:masturbation_move > 9
        ◆Show Picture:#1, outhouse_ryan_handjob_M3, Upper Left (150,0), (80%,60%), 255, Normal
        ◆If:masturbation_move > 12
          ◆Show Picture:#1, outhouse_ryan_handjob_M4, Upper Left (150,0), (80%,60%), 255, Normal
          ◆If:masturbation_move > 15
            ◆Show Picture:#1, outhouse_ryan_handjob_M5, Upper Left (150,0), (80%,60%), 255, Normal
            ◆If:masturbation_move > 18
              ◆Show Picture:#1, outhouse_ryan_handjob_M6, Upper Left (150,0), (80%,60%), 255, Normal
              ◆If:masturbation_move > 21
                ◆Show Picture:#1, outhouse_ryan_handjob_M7, Upper Left (150,0), (80%,60%), 255, Normal
                ◆If:masturbation_move > 24
                  ◆Show Picture:#1, outhouse_ryan_handjob_M8, Upper Left (150,0), (80%,60%), 255, Normal
                  ◆If:masturbation_move > 27
                    ◆Show Picture:#1, outhouse_ryan_handjob_M9, Upper Left (150,0), (80%,60%), 255, Normal
                    ◆If:masturbation_move > 30
                      ◆Show Picture:#1, outhouse_ryan_handjob_M10, Upper Left (150,0), (80%,60%), 255, Normal
                      ◆
                    :End
                    ◆
                  :End
                  ◆
                :End
                ◆
              :End
              ◆
            :End
            ◆
          :End
          ◆
        :End
        ◆
      :End
      ◆
    :End
    ◆
  :End
  ◆
:End
◆If:ryan lust = 500
  ◆Text:Ryan, None, Window, Bottom
  :    :I'm cumming....
  ◆Play SE:maleorgasm (100, 100, 0)
  ◆Show Picture:#1, outhouse_ryan_handjob_Cum01, Upper Left (150,0), (80%,60%), 255, Normal
  ◆Wait:60 frames
  ◆Show Picture:#1, outhouse_ryan_handjob_Cum02, Upper Left (150,0), (80%,60%), 255, Normal
  ◆Wait:60 frames
  ◆Wait:60 frames
  ◆Wait:60 frames
  ◆Show Picture:#1, outhouse_ryan_handjob_Cum03, Upper Left (150,0), (80%,60%), 255, Normal
  ◆Wait:60 frames
  ◆Stop SE
  ◆Text:Ryan, None, Window, Bottom
  :    :Ah, ha, ha, ha...
  :    :That felt good...
  ◆Erase Picture:#1
  ◆Control Variables:#0004 ryan lust = 0
  ◆Control Switches:#0007 outhouse_masterbate_on = OFF
  ◆Control Switches:#0002 peniswalk = ON
  ◆
:End
 

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,040
3,135
I have tried conditional switch but it was causing my cpu to ram up

I have also updated my code by using a class I've also updated the main post
 
  • Like
Reactions: Saki_Sliz

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,040
3,135
Take a look at what I just wrote, it can solve your problem.
will that work with what I have?

I have already changed my images name to outhouse_ryan_handjob_0.png to work with my code

Python:
class BATIONS(object):
        def __init__(self, name):
            self.name = name

        @property
        def mastur_image(self):
            global masturbation_move
            mtr = "masturbation/{}_{}.png".format(self.name, str(masturbation_move))


            if renpy.loadable(mtr):
                return mtr
            else:
                return "avatar/empty.png"

 
for q in MSTU:
        add q.mastur_image
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,174
will that work with what I have?
It replace it by something easier.

Instead of skipping a frame to make the animation go faster, you have an animation with a variable pause between each frame.

This being said, in your case a would be better. It would offer you control over the image to display (with the possibility to skip some if you want) and the delay between each image.
 
  • Like
Reactions: rayminator

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,040
3,135
I am having slightly small problem getting a black screen

Python:
if ryan_lust == 500:
        timer 0.001 action Hide("masturbation_move"), Call("masturb")

label masturb:
    show mas_icon2
    $ ryan_lust -= 500
    $ renpy.pause(3.0, hard=True)
    hide mas_icon2
    return
it didn't do this before

screenshot0016.png screenshot0017.png

edit: I have figure it out
 
Last edited: