Skip to content

Instantly share code, notes, and snippets.

@croxis
Created April 20, 2014 00:53
Show Gist options
  • Save croxis/11101980 to your computer and use it in GitHub Desktop.
Save croxis/11101980 to your computer and use it in GitHub Desktop.
nada
"""This is blank. Review python packages in the python manual for understanding."""
#Readd neededimports##
class CharacterSelector(DirectObject):
def __init__(self):
"""Move evething to be owned by the object that you don't want destroyed at the end of this function
IE: self.select = loader.loadModel("avatar_chooser_rope.bam")"""
select = loader.loadModel("avatar_chooser_rope.bam")
#This is what I used to find the Geom Nodes
#select.ls()
Play = DirectButton(geom = (select.find("**/avatar_c_B_bottom"),
select.find("**/avatar_c_B_bottom_over")),relief=None, scale=0.5)
Play.setPos(0,0,-0.9)
Player1 = DirectButton(geom = (select.find("**/avatar_c_A_bottom"),
select.find("**/avatar_c_A_bottom_over")),relief=None, scale=0.6)
Player1.setPos(-1.45,0,0.5)
Player2 = DirectButton(geom = (select.find("**/avatar_c_A_bottom"),
select.find("**/avatar_c_A_bottom_over")),relief=None, scale=0.6)
Player2.setPos(-1.45,0,0.35)
Player3= DirectButton(geom = (select.find("**/avatar_c_A_bottom"),
select.find("**/avatar_c_A_bottom_over")),relief=None, scale=0.6)
Player3.setPos(-1.45,0,0.2)
Player4= DirectButton(geom = (select.find("**/avatar_c_A_bottom"),
select.find("**/avatar_c_A_bottom_over")),relief=None, scale=0.6)
Player4.setPos(-1.45,0,0.05)
#Load dat dock
dock = loader.loadModel("phase_2\models\islands\pier_port_royal_1deck.bam")
dock.reparentTo(render)
dock.setPos(-8,170,-20)
dock.setH(270)
#get dat water
sea = loader.loadModel("phase_2\models\sea\sea.bam")
sea.reparentTo(render)
sea.setPos(0,0,-30)
#Create the character
mp = loader.loadModel("phase_2/models/char/mp_2000.bam")
mp.reparentTo(render)
mp.setPos(0, 8, -1)
#Character Clothing
mp.findAllMatches("**/clothing_layer*").hide()
mp.findAllMatches("**/clothing_layer1*").hide()
mp.findAllMatches("**/clothing_layer2*").hide()
mp.findAllMatches("**/hair*").hide()
mp.findAllMatches("**/acc_face*").hide()
mp.findAllMatches("**/beard*").hide()
mp.findAllMatches("**/mustache*").hide()
mp.findAllMatches("**/gh_master_face*").hide()
mp.findAllMatches("**/acc_body_ring*").hide()
mp.findAllMatches('**/hair_base').show()
mp.findAllMatches('**/hair_eyebrow_left').show()
mp.findAllMatches('**/hair_eyebrow_right').show()
mp.findAllMatches("**/body*").setColor(0.8, 0.7, 0.6, 1)
mp.findAllMatches('**/hair*').setColor(0.3, 0.2, 0.1, 1)
mp.findAllMatches('**/clothing_layer1_shoe_boot_tall_left').show()
mp.findAllMatches('**/clothing_layer1_shoe_boot_tall_right').show()
mp.findAllMatches('**/clothing_layer1_shirt_common_short_sleeve').show()
mp.findAllMatches('**/clothing_layer1_shirt_common_closed_base').show()
mp.findAllMatches('**/clothing_layer1_shirt_common_closed_front').show()
mp.findAllMatches('**/clothing_layer1_shirt_common_collar_v_high1').show()
mp.findAllMatches('**/clothing_layer1_shirt_common_bottom_in_closed_base').show()
mp.findAllMatches('**/clothing_layer1_shirt_common_bottom_in_closed_front').show()
mp.findAllMatches('**/body_torso_front').hide()
mp.findAllMatches('**/body_torso_back').hide()
mp.findAllMatches('**/body_waist').hide()
mp.findAllMatches('**/body_belt').hide()
mp.findAllMatches('**/body_foot_left').hide()
mp.findAllMatches('**/body_foot_right').hide()
mp.findAllMatches('**/body_shin_left').show()
mp.findAllMatches('*body_forearm_left*/body_shin_right').show()
mp.findAllMatches('**/body_knee_left').hide()
mp.findAllMatches('**/body_knee_right').hide()
mp.findAllMatches('**/body_collar_round').hide()
mp.findAllMatches('**/body_collar_sharp').hide()
mp.findAllMatches('**/hair_a1').show()
mp.findAllMatches('**/body_armpit_left').hide()
mp.findAllMatches('**/body_armpit_right').hide()
mp.findAllMatches('**/body_torso_base').hide()
mp.findAllMatches('**/body_shoulder_right').hide()
mp.findAllMatches('**/body_shoulder_left').hide()
mp.findAllMatches('**/clothing_layer1_pant_tucked_base').show()
mp.findAllMatches('**/clothing_layer2_belt_sash_reg_base').show()
mp.findAllMatches('**/clothing_layer2_belt_sash_reg_front').show()
tex = loader.loadTexture('phase_2\maps\PM_shirt_shared_cloth_plain1.jpg')
mp.find('**/clothing_layer1_shirt_common_short_sleeve').setTexture(tex, 1)
mp.find('**/clothing_layer1_shirt_common_closed_base').setTexture(tex, 1)
mp.find('**/clothing_layer1_shirt_common_closed_front').setTexture(tex, 1)
mp.find('**/clothing_layer1_shirt_common_collar_v_high1').setTexture(tex, 1)
mp.find('**/clothing_layer1_shirt_common_bottom_in_closed_base').setTexture(tex, 1)
mp.find('**/clothing_layer1_shirt_common_bottom_in_closed_front').setTexture(tex, 1)
belt = loader.loadTexture('phase_2\maps\PM_belt_sash_plain.jpg')
mp.find('**/clothing_layer2_belt_sash_reg_front').setTexture(belt, 1)
mp.find('**/clothing_layer2_belt_sash_reg_base').setTexture(belt, 1)
shoe = loader.loadTexture('phase_2\maps\PM_shoe_tall_boots_TanWithFlap.jpg')
mp.find('**/clothing_layer1_shoe_boot_tall_left').setTexture(shoe, 1)
mp.find('**/clothing_layer1_shoe_boot_tall_right').setTexture(shoe, 1)
pants = loader.loadTexture('phase_2\maps\PM_pant_long_pants_tucked_leathergoldbuttons_nopatch.jpg')
mp.find('**/clothing_layer1_pant_tucked_base').setTexture(pants, 1)
mp.find('**/clothing_layer1_pant_tucked_base').setColor(0.35, 0.4, 0.5, 1)
eyeball = loader.loadTexture("phase_2\maps\pupilHazel.jpg")
mp.findAllMatches("**/eye_iris*").setTexture(eyeball, 1)
def destroy(self):
"""Tears down everything in the character selector."""
pass
def select_character(self, *args, **kwargs):
"""What happens when a character is selected? Use pandas messenger"""
# logic #
if slot_empty:
messenger.send("charactercreate
# Imports need a serious cleanup
from direct.actor.Actor import Actor
from pandac.PandaModules import *
from direct.task import Task
import math
from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.interval.IntervalGlobal import Sequence
from pandac.PandaModules import Point3
from pandac.PandaModules import *
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.actor.Actor import Actor
from direct.showbase.InputStateGlobal import inputState
import direct.directbase.DirectStart
from panda3d.core import CollisionTraverser,CollisionNode
from panda3d.core import CollisionHandlerQueue,CollisionRay
from panda3d.core import Filename,AmbientLight,DirectionalLight
from panda3d.core import PandaNode,NodePath,Camera,TextNode
from panda3d.core import Vec3,Vec4,BitMask32
from direct.gui.OnscreenText import OnscreenText
from direct.actor.Actor import Actor
from direct.showbase.DirectObject import DirectObject
from sys import argv
from direct.directbase import DirectStart
from direct.task import Task
from direct.actor.Actor import Actor
from direct.showbase import DirectObject
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from direct.showbase.InputStateGlobal import inputState
from direct.controls.GravityWalker import GravityWalker
from panda3d.core import *
from panda3d.core import Plane, PlaneNode, TransparencyAttrib, Texture, Vec3, Point3, NodePath, TextureStage, CullFaceAttrib, BitMask32
from .character_creation import CharacterSelector
# Using a FSM will be better here
class Manager(DirectObject):
def __init__(self):
# Double check the messenger section of the manual for syntax
self.accept("characterselection", self.char_select)
self.accept("charactercreate", self.char_create)
def char_select(self):
self.select = CharacterSelector()
def char_create(self):
self.select.destroy()
self.select = None
camera.hide()
base.oobe()
manager = Manager()
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment