Results 1 to 1 of 1
  1. #1
    Member Cotaks's Avatar
    Join Date
    May 2012
    Location
    The Netherlands
    Posts
    1,187

    Cotaks resources

    This page shows the resources that i share.

    They all are free to use but you may not sell it to others(of course you may sell it as/in a game). It are free resources and it should stay that way! Most of these blends/script are python based.

    If you can use it, use it.
    One of the blends not working in Bge? feel free to send me a pm.

    All things below should work in Bge from version 2.6+ until latest release (2.78a)
    i dont give suport to UPbge but they should all work up to 0.1.4 (some things have changed compared to bge use the console output to see what you need to change).

    Double tap or more to run (w = walk, w again is running)
    double w is running.blend (pure bricks, no python)

    FPS engine bundle: (merged some scripts into 1)
    https://blenderartists.org/forum/sho...-engine-bundle

    Random assets placer:
    https://blenderartists.org/forum/sho...70#post3210370

    Game settings / Launcher:
    https://blenderartists.org/forum/sho...tings-launcher

    Save and load:
    https://blenderartists.org/forum/sho...-v3-0-by-cotax

    Inventory:
    https://blenderartists.org/forum/sho...2-74-Inventory

    Loading screen with Async, progress bar and text:
    https://blenderartists.org/forum/sho...s-bar-and-text

    First person movement script with keybindings
    https://blenderartists.org/forum/sho...ovement-script

    Third person Tera/Eso style movement system with key and mouse bindings (8 directional):
    https://blenderartists.org/forum/sho...ovement-system

    Endless runner:
    https://blenderartists.org/forum/sho...ss-runner-v1-2

    Mini and world map with the option to rotate and zoom:
    https://blenderartists.org/forum/sho...nd-zoom-(v2-0)

    Key and mouse bindings:
    https://blenderartists.org/forum/sho...mouse-bindings

    Light manager:
    https://blenderartists.org/forum/sho...-Light-manager

    Click to move:
    https://blenderartists.org/forum/sho...oint-and-click

    Low poly human model:
    https://blenderartists.org/forum/sho...ly-human-model

    Teleport script:
    https://blenderartists.org/forum/sho...ort-script-2-6

    Track to nearest property (single and all axis):
    track_to_closest.blend


    - Level of detail:
    Code:
    #
    # LoD by cotax
    #
    
    
    # Place a property on the object that needs LoD, call it lod_mesh and put the origional mesh name in it.
    # Now duplicate it as much as you like. 
    # Make a low poly mesh, call that mesh: origionalname_far (so put _far behind the origional mesh name).
    
    
    # You can use the property on the low poly instead of the high one, easier to work with ;).
    # (only 1 mesh type needs a property, either the high one or low one depending on what you place in the main scene)
    
    
    # Use the update_lod_list(cont) to update the list when needed
    
    
    def lod(cont):
        
        own = cont.owner
    
    
        if not 'lod_list' in own:
            update_lod_list(cont)
            get_distances(cont)
        
        player = own.scene.objects['player']
                    
        for obj in own['lod_list']:
            
            distance    = player.getDistanceTo(obj)
            mesh_name   = obj['lod_mesh']
                
            # get LOD distances
            min, max  = own['lod_distances'][mesh_name][0], own['lod_distances'][mesh_name][1]
            
            if distance <= min:
                visible(obj, True)           
                change_mesh(obj, mesh_name)
            elif distance > min and distance <= max:
                visible(obj, True)
                change_mesh(obj, mesh_name + '_far')
            else:
                visible(obj, False)  
    
    
    
    
    def update_lod_list(cont):
        
        own = cont.owner   
        own['lod_list'] = [obj for obj in own.scene.objects if 'lod_mesh' in obj]
              
                 
    def get_distances(cont):
           
        own = cont.owner
        
        own['lod_distances'] = { # mesh name - min - max
                        'tree_green_leaves':    [30,60], 
                        'flower_red':           [20,50],
                        'flower_blue':          [20,40],
                        'platform_stone':       [40,75],
                        'platform_grass':       [40,75],
                        'platform_sand':        [40,75],
                        'platform_tree':        [40,75]
                        }
    
    
    
    
    def visible(obj, state):
        
        if state:
            if not obj.visible:
                #obj.restoreDynamics()
                obj.visible = True
                
        elif not state:
            if obj.visible:
                #obj.suspendDynamics()
                obj.visible = False
            
    
    
    def change_mesh(obj, mesh_name):
        
        mesh = obj.meshes[0].name
    
    
        if mesh != mesh_name:
            obj.replaceMesh(mesh_name)

    - Key event strings to readable/show able text. (from ZEROKEY to 0, ONEKEY to 1, etc)
    Code:
    def key_event_readable(key_event_name):
            
        text_to_number = {  
                            #keyboard
                            'ZEROKEY'           :"0",
                            'ONEKEY'            :"1",
                            'TWOKEY'            :"2",
                            'THREEKEY'          :"3",
                            'FOURKEY'           :"4",
                            'FIVEKEY'           :"5",
                            'SIXKEY'            :"6",
                            'SEVENKEY'          :"7",
                            'EIGHTKEY'          :"8",
                            'NINEKEY'           :"9",
                            
                            'ACCENTGRAVEKEY'    :"`",
                            'BACKSPACEKEY'      :"<-",
                            'COMMAKEY'          :",",
                            'EQUALKEY'          :"=",
                            'LEFTBRACKETKEY'    :"[",
                            'RIGHTBRACKETKEY'   :"]",
                            'MINUSKEY'          :"-",
                            'PERIODKEY'         :".",
                            'SEMICOLONKEY'      :";",
                            'SLASHKEY'          :"/",
                            'BACKSLASHKEY'      :"\\",
                            'QUOTEKEY'          :"'",
                            'RETKEY'            :"Return",
                            
                            'PADPLUSKEY'        :"Pad +",
                            'PADSLASHKEY'       :"Pad /",
                            'PADASTERKEY'       :"Pad *",
                            'PADPERIOD'         :"Pad .",
                            'PADMINUS'          :"Pad -",
    
    
                            #mouse
                            'WHEELUPMOUSE'      :"Scroll up",
                            'WHEELDOWNMOUSE'    :"Scroll down",
                            'LEFTMOUSE'         :"LB",
                            'RIGHTMOUSE'        :"RB",
                            'MIDDLEMOUSE'       :"MMB"
                        }
                                    
        if key_event_name in text_to_number:
            return text_to_number[key_event_name]
        elif key_event_name.endswith('KEY'):
            return key_event_name[:-3]
        elif key_event_name.endswith('MOUSE'):
            return key_event_name[:-5]
        else: 
            return key_event_name

    If you readed it all and still have nothing to do try my Crazy flipper(pinball) game:
    https://blenderartists.org/forum/sho...=crazy+flipper
    Last edited by Cotaks; 16-Nov-17 at 21:11.
    '- It's not working' then check your console like: this
    Did you know that you can make a complete game with the .blends that i share?



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •