![]() ![]() Self._pick_rotate = 180 - the_angle # Draw the angle on a coordinate system, you will understand why it's 180 - the_angleĮlif mouse_pos = 1080 / 2: # If mouse is on the lower part of the screen Self._pick_rotate = 180 # Pick can't rotate further than 180 degreeĮlse: # If mouse is on the upper part of the screen (and is on the right half) If mouse_pos >= 1080 / 2: # If mouse if on the lower part of the screen If mouse_pos > 1920 / 2: # If mouse is on the right half of the screen ![]() The_angle = calculate_angle(len_mouse_to_ox, len_mouse_to_root) If len_mouse_to_root != 0: # To prevent the weird situation when the player try to put there mouse in the exact middle of the screen, if we just calculate the angle without the condition and that weird situation happen, an error "divide by zero" will raise Len_mouse_to_root = calculate_length(mouse_pos, root) # Calculate the distance from mouse pos to the origin Len_mouse_to_ox = calculate_length(mouse_pos, mouse_on_ox) # Calculate the distance from mouse pos to its perpendicular on coordinate x axis Root = ( 1920 / 2, 1080 / 2) # Origin of the coordinate (but in vietnam we call it root) Mouse_on_ox = (mouse_pos, 1080 / 2) # Perpendicular of mouse pos on coordinate x axis Mouse_pos = renpy.get_mouse_pos() # Current mouse postion # This is more accurate than the formular on renpy cookbook # Calculating the pick rotate angle based on mouse position # Function that continuously updates the graphics of the lockĭef render( self, width, height, st, at): Self._cylinder_try_rotate = True # the cylinder will try to rotateĮlif ev.type = pygame.MOUSEBUTTONUP and ev.button = LEFT: If ev.type = pygame.MOUSEBUTTONDOWN and ev.button = LEFT: Self._break_time = difficulty / 10 + 0.75 # A number based on difficulty, the amount of time before the lock pick breaks Self._difficulty = difficulty # A number between 1 and 29 - the lower the number, the more difficult the lock Self._correct_pos = ( 0, 180) # A point between 0 and 180 determined randomly when the lock is created Self._pick_broke = False # If the pick just broke Self._pick_can_rotate = True # If the pick can rotate Self._pick_rotate = 90 # The current angle of the pick Self._cylinder_try_rotate = False # If the cylinder is attempting to rotate (which mean the left mouse button is held down) Self._cylinder_rotate = 0 # The current angle of cylinder Self._cylinder_max = 90 # The maximum angle allowed for the cylinder Self._cylinder_min = 0 # The minimum angle allowed for the cylinder Self._lock_pick_image = Transform( "images/lock_pick.png ", size = (resize, resize)) Self._lock_tension_image = Transform( "images/lock_tension.png ", size = (resize, resize)) Self._lock_cylinder_image = Transform( "images/lock_cylinder.png ", size = (resize, resize)) Self._lock_plate_image = Transform( "images/lock_plate.png ", size = (resize, resize)) _channel( "Lock_Click ", mixer = "sfx ", loop = False, tight = True)ĭef _init_( self, difficulty, resize = 1920, ** kwargs): ![]() *This came up due to the need of having any button (including hyperlinks) behaving the same way while being easy to _channel( "Lock_Move ", mixer = "sfx ", loop = True) This feels intuitive:Įdit: I found out about hyperlink_function but its too complex for begginers for simply adding a sound or cursor. Is this supported? I read on Ren'Py Gripes it was but I can't find the documentation. #LOCKING A QUICKMENU BUTTON RENPY HOW TO#
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |