Skip to content

Commit

Permalink
uploading all files
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepan committed Jan 11, 2017
1 parent c41ade7 commit 496b864
Show file tree
Hide file tree
Showing 198 changed files with 3,931 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
@@ -1,5 +1,4 @@
/offline/
/files/

# Windows image file caches
Thumbs.db
Expand Down
Binary file added files/Chapter2/game_final/assets/school.blend
Binary file not shown.
Binary file added files/Chapter2/game_final/assets/shark.blend
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter2/game_final/game.blend
Binary file not shown.
Binary file added files/Chapter2/game_final/interface/score.blend
Binary file not shown.
Binary file added files/Chapter2/game_final/level/seabed.blend
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter2/game_final/sounds/gameover.m4a
Binary file not shown.
Binary file added files/Chapter2/game_final/sounds/sharked.m4a
Binary file not shown.
Binary file added files/Chapter2/game_final/sounds/water.m4a
Binary file not shown.
Binary file added files/Chapter2/game_my/level/seabed.blend
Binary file not shown.
Binary file added files/Chapter2/game_my/level/textures/seabed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter2/game_my/sounds/gameover.m4a
Binary file not shown.
Binary file added files/Chapter2/game_my/sounds/sharked.m4a
Binary file not shown.
Binary file added files/Chapter2/game_my/sounds/water.m4a
Binary file not shown.
Binary file added files/Chapter2/game_progress/assets/school.blend
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter2/game_progress/game.1.blend
Binary file not shown.
Binary file added files/Chapter2/game_progress/game.2.blend
Binary file not shown.
Binary file added files/Chapter2/game_progress/game.3.blend
Binary file not shown.
Binary file added files/Chapter2/game_progress/game.4.blend
Binary file not shown.
Binary file added files/Chapter2/game_progress/game.5.blend
Binary file not shown.
Binary file added files/Chapter2/game_progress/game.6.blend
Binary file not shown.
Binary file not shown.
Binary file added files/Chapter2/game_progress/level/seabed.blend
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter2/game_progress/sounds/gameover.m4a
Binary file not shown.
Binary file added files/Chapter2/game_progress/sounds/sharked.m4a
Binary file not shown.
Binary file added files/Chapter2/game_progress/sounds/water.m4a
Binary file not shown.
Binary file added files/Chapter2/references/shark-front.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter2/references/shark-right.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter2/references/shark-top.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter3/bowling_base.blend
Binary file not shown.
Binary file added files/Chapter3/bowling_final.blend
Binary file not shown.
Binary file added files/Chapter3/controller_expression.blend
Binary file not shown.
Binary file not shown.
Binary file added files/Chapter3/controller_expression_toggle.blend
Binary file not shown.
Binary file added files/Chapter3/group_instancing_logic_1.blend
Binary file not shown.
Binary file added files/Chapter3/group_instancing_logic_2.blend
Binary file not shown.
Binary file added files/Chapter3/influence_dynamic.blend
Binary file not shown.
Binary file added files/Chapter3/sensor_actuator.blend
Binary file not shown.
Binary file added files/Chapter3/sensor_keyboard.blend
Binary file not shown.
Binary file added files/Chapter4/1_constraints_transform.blend
Binary file not shown.
Binary file added files/Chapter4/2_cartoon_arm.blend
Binary file not shown.
Binary file added files/Chapter4/3_action_constraint.blend
Binary file not shown.
Binary file added files/Chapter4/4_shape_driven.blend
Binary file not shown.
Binary file added files/Chapter4/ExtremePoseFront.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter4/ExtremePoseSide.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter4/mangojambo.blend
Binary file not shown.
Binary file added files/Chapter4/pretutorial_camera_actions.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_hat_1.begin.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_hat_2.capsetup.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_hat_3.animatedcap.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_hat_4.animatedhats.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_idle_1.begin.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_idle_2.shapekeys_ui.blend
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added files/Chapter4/tutorial_idle_5.action.blend
Binary file not shown.
Binary file not shown.
Binary file added files/Chapter4/tutorial_idle_7.turning.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_walk_1.begin.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_walk_2.ik.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_walk_3.trackto.blend
Binary file not shown.
Binary file not shown.
Binary file added files/Chapter4/tutorial_walk_5.extremeposes.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_walk_6.rootbone.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_walk_7.placeholder.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_walk_8.pose_to_pose.blend
Binary file not shown.
Binary file added files/Chapter4/tutorial_walk_9.playtime.blend
Binary file not shown.
Binary file added files/Chapter4/tutorials_momobase.blend
Binary file not shown.
Binary file added files/Chapter5/2DFilter.blend
Binary file not shown.
Binary file added files/Chapter5/BlendingMode.blend
Binary file not shown.
Binary file added files/Chapter5/GLSL1.blend
Binary file not shown.
Binary file added files/Chapter5/GLSL2.blend
Binary file not shown.
Binary file added files/Chapter5/GLSL3.blend
Binary file not shown.
Binary file added files/Chapter5/Textures/Earth4K/E_clouds.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter5/Textures/Earth4K/E_col.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter5/Textures/Earth4K/E_emit.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter5/Textures/Earth4K/E_spec.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter5/Textures/Noise.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter5/Textures/blendedskies_river.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions files/Chapter5/Textures/blendedskies_river.txt
@@ -0,0 +1,10 @@
River: Panorama - shot just across the Ohio River from Louisville, KY, the "Falls of the Ohio".
courtesy of Sam Schad (c) www.blendedskies.com

This image was tone-mapped to LDR and downsized for its usage in the book.

The original HDR panorama can be downloaded for free at:
http://www.blendedskies.com/MediaDetails/tabid/89/ProductID/44/Default.aspx

The original file license can be found at:
http://www.blendedskies.com/ExtraInfo/GeneralUsageLicense
Binary file added files/Chapter5/Textures/uffizi_probe.hdr
Binary file not shown.
Binary file added files/Chapter5/Textures/uffizi_rectangular.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/Chapter5/ocean.blend
Binary file not shown.
Binary file added files/Chapter6/compound-finished.blend
Binary file not shown.
Binary file added files/Chapter6/compound.blend
Binary file not shown.
6 changes: 6 additions & 0 deletions files/Chapter6/demo/CREDITS.txt
@@ -0,0 +1,6 @@
Most of those files were originally part of Blender test suite.
They were adjusted to work in the latest Blender, and at some point
will be re-uploaded back to Blender SVN test suite.

Their licenses are independent as of the other book files, and we claim
no ownership over them.
Binary file added files/Chapter6/demo/ConstraintsChain.blend
Binary file not shown.
Binary file added files/Chapter6/demo/ConstraintsTrampoline.blend
Binary file not shown.
Binary file added files/Chapter6/demo/ConstraintsWaterMill.blend
Binary file not shown.
Binary file added files/Chapter6/demo/PhysicsTypes.blend
Binary file not shown.
Binary file added files/Chapter6/demo/bulletHouse.blend
Binary file not shown.
Binary file added files/Chapter6/demo/constraints.blend
Binary file not shown.
Binary file added files/Chapter6/earthMars-finished.blend
Binary file not shown.
Binary file added files/Chapter6/earthMars.blend
Binary file not shown.
Binary file added files/Chapter6/navigation-finished.blend
Binary file not shown.
Binary file added files/Chapter6/navigation.blend
Binary file not shown.
Binary file added files/Chapter6/physicsOccluder.blend
Binary file not shown.
Binary file added files/Chapter6/softbody.blend
Binary file not shown.
Binary file added files/Chapter6/vehicle/car.blend
Binary file not shown.
191 changes: 191 additions & 0 deletions files/Chapter6/vehicle/scripts.py
@@ -0,0 +1,191 @@
# #############################
# Vehicle Physics Demo
# #############################
# This file is part of the book:
# "Game Development with Blender"
# by Dalai Felinto and Mike Pan
#
# Published by "CENGAGE Learning" in 2013
#
# You are free to use-it, modify it and redistribute
# as long as you keep the original credits when pertinent.
#
# File tested with Blender 2.66
#
# Copyright - February 2013
# This work is licensed under the Creative Commons
# Attribution-Share Alike 3.0 Unported License
# #############################

## First, we import all the python module
from bge import constraints
from bge import logic
from bge import events
from bge import render

import math

## Set specific vehicle characteristics ##
wheelRadius = 0.5
wheelBaseWide = 1.0
wheelFrontOffset = 0.7
wheelBackOffset = -1.8
AttachHeightLocal = 0.2
suspensionLength = 0.8
influence = 0.02
stiffness = 20.0
damping = 2.0
compression = 4.0
friction = 10.0
Stability = 0.05

## This is called from the car object
## is run once at the start of the game
def carInit():

## setup aliases for Blender API access ##
cont = logic.getCurrentController()
logic.scene = logic.getCurrentScene()
logic.car = cont.owner

## setup general vehicle characteristics ##
wheelAttachDirLocal = [0,0,-1]
wheelAxleLocal = [-1,0,0]

## setup vehicle physics ##
vehicle = constraints.createConstraint(logic.car.getPhysicsId(),0,11)
logic.car["cid"] = vehicle.getConstraintId()
vehicle = constraints.getVehicleConstraint(logic.car["cid"])

## initialize temporary variables ##
logic.car["dS"] = 0.0

## attached wheel based on actuator name ##
wheel0 = logic.scene.objects["Wheel0"]
wheelAttachPosLocal = [wheelBaseWide ,wheelFrontOffset, AttachHeightLocal]
vehicle.addWheel(wheel0,wheelAttachPosLocal,wheelAttachDirLocal,wheelAxleLocal,suspensionLength,wheelRadius,1)

wheel1 = logic.scene.objects["Wheel1"]
wheelAttachPosLocal = [-wheelBaseWide ,wheelFrontOffset, AttachHeightLocal]
vehicle.addWheel(wheel1,wheelAttachPosLocal,wheelAttachDirLocal,wheelAxleLocal,suspensionLength,wheelRadius,1)

wheel2 = logic.scene.objects["Wheel2"]
wheelAttachPosLocal = [wheelBaseWide ,wheelBackOffset, AttachHeightLocal]
vehicle.addWheel(wheel2,wheelAttachPosLocal,wheelAttachDirLocal,wheelAxleLocal,suspensionLength,wheelRadius,0)

wheel3 = logic.scene.objects["Wheel3"]
wheelAttachPosLocal = [-wheelBaseWide ,wheelBackOffset, AttachHeightLocal]
vehicle.addWheel(wheel3,wheelAttachPosLocal,wheelAttachDirLocal,wheelAxleLocal,suspensionLength,wheelRadius,0)

## set vehicle roll tendency ##
vehicle.setRollInfluence(influence,0)
vehicle.setRollInfluence(influence,1)
vehicle.setRollInfluence(influence,2)
vehicle.setRollInfluence(influence,3)

## set vehicle suspension hardness ##
vehicle.setSuspensionStiffness(stiffness,0)
vehicle.setSuspensionStiffness(stiffness,1)
vehicle.setSuspensionStiffness(stiffness,2)
vehicle.setSuspensionStiffness(stiffness,3)

## set vehicle suspension dampness ##
vehicle.setSuspensionDamping(damping,0)
vehicle.setSuspensionDamping(damping,1)
vehicle.setSuspensionDamping(damping,2)
vehicle.setSuspensionDamping(damping,3)

## set vehicle suspension compression ratio ##
vehicle.setSuspensionCompression(compression,0)
vehicle.setSuspensionCompression(compression,1)
vehicle.setSuspensionCompression(compression,2)
vehicle.setSuspensionCompression(compression,3)

## set vehicle tire friction ##
vehicle.setTyreFriction(friction,0)
vehicle.setTyreFriction(friction,1)
vehicle.setTyreFriction(friction,2)
vehicle.setTyreFriction(friction,3)


## called from main car object
## is run once at the start of the game
def carHandler():
vehicle = constraints.getVehicleConstraint(logic.car["cid"])

## calculate speed by using the back wheel rotation speed ##
S = vehicle.getWheelRotation(2)+vehicle.getWheelRotation(3)
logic.car["speed"] = (S - logic.car["dS"])*10.0

## apply engine force ##
vehicle.applyEngineForce(logic.car["force"],0)
vehicle.applyEngineForce(logic.car["force"],1)
vehicle.applyEngineForce(logic.car["force"],2)
vehicle.applyEngineForce(logic.car["force"],3)

## calculate steering with varying sensitivity ##
if math.fabs(logic.car["speed"])<15.0: s = 2.0
elif math.fabs(logic.car["speed"])<28.0: s=1.5
elif math.fabs(logic.car["speed"])<40.0: s=1.0
else: s=0.5

## steer front wheels
vehicle.setSteeringValue(logic.car["steer"]*s,0)
vehicle.setSteeringValue(logic.car["steer"]*s,1)

## slowly ease off gas and center steering ##
logic.car["steer"] *= 0.6
logic.car["force"] *= 0.9

## align car to Z axis to prevent flipping ##
logic.car.alignAxisToVect([0.0,0.0,1.0], 2, Stability)

## store old values ##
logic.car["dS"] = S



## called from main car object
def keyHandler():
cont = logic.getCurrentController()
keys = cont.sensors["key"].events
for key in keys:
## up arrow
if key[0] == events.UPARROWKEY:
logic.car["force"] = -15.0
## down arrow
elif key[0] == events.DOWNARROWKEY:
logic.car["force"] = 10.0
## right arrow
elif key[0] == events.RIGHTARROWKEY:
logic.car["steer"] -= 0.05
## left arrow
elif key[0] == events.LEFTARROWKEY:
logic.car["steer"] += 0.05
## Reverse
elif key[0] == events.RKEY:
if key[1] == 1:
# re-orient car
if logic.car["jump"] > 2.0:
pos = logic.car.worldPosition
logic.car.position = (pos[0], pos[1], pos[2]+3.0)
logic.car.alignAxisToVect([0.0,0.0,1.0], 2, 1.0)
logic.car.setLinearVelocity([0.0,0.0,0.0],1)
logic.car.setAngularVelocity([0.0,0.0,0.0],1)
logic.car["jump"] = 0
## Spacebar
elif key[0] == events.SPACEKEY:
# hackish Brake
if logic.car["speed"] > 2.0:
logic.car["force"] = 15.0
if logic.car["speed"] < -2.0:
logic.car["force"] = -15.0


## called from shadow lamp
def shadow():
cont = logic.getCurrentController()
ownpos = [-5.0,0.0,8.0]
pos = logic.car.worldPosition
cont.owner.worldPosition = [pos[0]+ownpos[0], pos[1]+ownpos[1], pos[2]+ownpos[2]]

Binary file added files/Chapter6/water-finished.blend
Binary file not shown.
Binary file added files/Chapter6/water.blend
Binary file not shown.
Binary file added files/Chapter7/1_reloadme/debug_python.blend
Binary file not shown.
35 changes: 35 additions & 0 deletions files/Chapter7/1_reloadme/script.py
@@ -0,0 +1,35 @@
# #############################
# Python Module Controller Demo
# #############################
# This file is part of the book:
# "Game Development with Blender"
# by Dalai Felinto and Mike Pan
#
# Published by "CENGAGE Learning" in 2013
#
# You are free to use-it, modify it and redistribute
# as long as you keep the original credits when pertinent.
#
# File tested with Blender 2.66
#
# Copyright - February 2013
# This work is licensed under the Creative Commons
# Attribution-Share Alike 3.0 Unported License
# #############################

from bge import logic

""" this script will be re-load every frame.
Remember to save the file after you change-it. """
def reload_me(controller):
# controller = logic.getCurrentController()
own = controller.owner

# edit the speed value and you will see the rotation changing
# (try with values from 0.01 to 0.05)
speed = 0.025

# now try to comment and uncomment the following lines
# adding or removing # from the begin of the line)
own.applyRotation([0,0,speed],0)
# own.applyRotation([speed,0,0],0)
55 changes: 55 additions & 0 deletions files/Chapter7/2_oop/init_world.py
@@ -0,0 +1,55 @@
# #############################
# Oriented Object Programming Demo
# #############################
# This file is part of the book:
# "Game Development with Blender"
# by Dalai Felinto and Mike Pan
#
# Published by "CENGAGE Learning" in 2013
#
# You are free to use-it, modify it and redistribute
# as long as you keep the original credits when pertinent.
#
# File tested with Blender 2.66
#
# Copyright - February 2013
# This work is licensed under the Creative Commons
# Attribution-Share Alike 3.0 Unported License
# #############################

import bge
from bge import logic as G
from bge import render as R

# showing the mouse cursor
R.showMouse(True)

# storing the current scene in a variable
scene = G.getCurrentScene()

# define a class to store all group elements and the click object
class Group():
def __init__(self, name):
self.name = name
self.click = None
self.objects = []

# create new element groups
cube_group = Group("cubes")
sphere_group = Group("sphere")

# add all objects with an "ui" property to the created element
for obj in scene.objects:
if "cube" in obj:
cube_group.objects.append(obj)
elif "sphere" in obj:
sphere_group.objects.append(obj)
elif "click" in obj:
exec("%s_group.click = obj" % (obj["click"]))
# note exec here is replacing:
# if obj["click"] == "cube":
# cube_group.click = obj
# elif obj["click"] == "sphere":
# sphere_group.click = obj

G.groups = {"cube":cube_group, "sphere":sphere_group}
Binary file added files/Chapter7/2_oop/oop.blend
Binary file not shown.
38 changes: 38 additions & 0 deletions files/Chapter7/2_oop/visibility_check.py
@@ -0,0 +1,38 @@
# #############################
# Oriented Object Programming Demo
# #############################
# This file is part of the book:
# "Game Development with Blender"
# by Dalai Felinto and Mike Pan
#
# Published by "CENGAGE Learning" in 2013
#
# You are free to use-it, modify it and redistribute
# as long as you keep the original credits when pertinent.
#
# File tested with Blender 2.66
#
# Copyright - February 2013
# This work is licensed under the Creative Commons
# Attribution-Share Alike 3.0 Unported License
# #############################

import bge
from bge import logic as G

# defines a function to hide/turn visible all the objects passed as argument
def change_visibility(objects, on_off):
for obj in objects:
obj.visible = on_off

# retrieve the stored groups to local variables
cube_group = G.groups["cube"]
sphere_group = G.groups["sphere"]

# read the current value of the "on_off" property in the cube/sphere
cube_visible = cube_group.click["on_off"]
sphere_visible = sphere_group.click["on_off"]

# calls the function into the group object with the visibility flag
change_visibility(cube_group.objects, cube_visible)
change_visibility(sphere_group.objects, sphere_visible)
Binary file added files/Chapter7/3_template/abracadabra.blend
Binary file not shown.
39 changes: 39 additions & 0 deletions files/Chapter7/3_template/abracadabra.py
@@ -0,0 +1,39 @@
# #############################
# Simple Sensor, Controller and Actuator Demo
# #############################
# This file is part of the book:
# "Game Development with Blender"
# by Dalai Felinto and Mike Pan
#
# Published by "CENGAGE Learning" in 2013
#
# You are free to use-it, modify it and redistribute
# as long as you keep the original credits when pertinent.
#
# File tested with Blender 2.66
#
# Copyright - February 2013
# This work is licensed under the Creative Commons
# Attribution-Share Alike 3.0 Unported License
# #############################

import bge
from bge import logic

cont = logic.getCurrentController()
owner = cont.owner

scene = logic.getCurrentScene()
objects = scene.objects
text_obj = objects["Text"]

sens = cont.sensors['my_sensor']
act = cont.actuators['my_actuator']

if sens.positive:
cont.activate(act)
text_obj.text = "CADABRA"
else:
cont.deactivate(act)
text_obj.text = "ABRA"

0 comments on commit 496b864

Please sign in to comment.