Chapter 1

Where are the words to describe the wind upon my face as it whispers in my ear universal secrets? What can I say about the sun on my face, warming, burning, beckoning me to adventures in far off places? Who can explain the true nature of the ocean’s waves, that hide great secrets in plain sight among crystal waters by presenting a simple distraction, the horizon? What surer tempo can any clock beat to compare to a man’s heart, when it finds itself in the moment of discovery?

I am born, and all the stuff that goes with it. I grew to adulthood with the same trials and tribulations any man has among the comforts of middle class. I tasted love for the first time. I was taught about reading, writing, arithmetic at school. I was taught how to handle real life by watching reruns on TV.

At the age of 25, sightly later than my peers, I found myself alone in a bar with a piece of paper that told the world I had achieved distinction as a bachelor of arts in a field, my high school counselor said, I had an aptitude for. Sitting in the quiet buzz of my fourth beer I doubted my aptitude to accomplish anything.

School was gone and I was living at home again. My parents were kind, but they had a way of turning a meal into a sort of therapy/career counseling session where they asked open ended questions, trying to get me into commit to a course of life – like them. It was hard to respond openly. I told them I spent my days looking for work and studying at the library for opportunities in my profession.

It wasn’t a complete lie. I went to the library often. It was quiet and I could read without being disturbed – novels mostly. The library was new and full of all kinds of media. Man had all but abandoned the old tried by true book. They were still there in stacks and rows, untouched. I wandered back there for the smell more than the knowledge contained within their pages.

The revelry of the moment was interrupted by the door as it slammed open. The late afternoon light startled me and the bartender. I selected this particular bar because it is quiet and dark, not just in the corners where furtive couples hold hands and conspire to cheat.

The high concentration of light assaulted the us. As I squinted against it and turned my head away from it and picked up my glass. I mused the bar had just received about three years worth of energy in that one blast. The thought made me half smile.

The door closed slowly, and out of the corner of my eye a silhouette wobbled toward me. He stopped and turned just short of bumping into me. He slapped both hands on the bar, and looked at the wall of liquor. He looked like he was trying to be casual, but I could tell, he was using the bar to support himself.

He slapped again. The bartender, who had conveniently receded into a darker corner to restock the ice while the door was open, returned and stood before the man waiting silently.

“Whiskey. “

The bartender produced a shot glass from nowhere and poured an precise shot.

One hand still holding the bar, the other grabbed the shot glass, swung his arm up, his head back, then his arm down in one fluid motion. The shot glass banged loudly as he slammed it back. Bam-bam-bam.

“Again.”

The bartender poured, then stood back. The man repeated the same fluid motion, but this time he replaced the shot glass gently to the bar, like placing a baby in a crib.

“Ahhh,” he declared dramatically. He curled is lower lip and rested his tongue on it. Then he turned to me.

One eye was closed, the other, piercing blue sat rheumy in a bloodshot socket. Brown curly hair, he had five days growth on his face. He closed his mouth and wobbled at me, as if moving would bring me into clearer focus.

“I am Quint,” he said turning toward me and offering me his hand.” The name my parents gave me was Harrison Christopher Byrne, but I prefer Quint.”

“Because of the captain in the movie Jaws?” I took his hand and shook.

“Nah,” he shook his head, “I had two older brothers I was always tagging along after. They called me little squint. Over time they shortened it to Quint. God, I miss them.”

“Trevor Wilson,” I said.

He opened both eyes and really looked at me, appraising. His eyes were so intensely blue. I was glad he had prepared me by showing just the one when we met. He turned back to look at the empty glass in front of him.

“Know anything about the movies, Trev?” he asked rolling the shot between his fingers.

“No. I’ve watched a lot of TV. does that count?”

He looked thoughtful for a brief moment. “How about steady. How steady is your hand?”

I held it before him and held it. He stared at it, one eye slightly larger than the other, willing it to move. It did not. After a few seconds he turned back to consider his glass.

He thumped the bar with his pointed index finger, and the bartender filled the glass again.

He rolled the glass between his fingers for a moment, still in thought.

“Ever heard of a second unit?”

“A what?” I replied.

“Second unit, in movies.” He said.

“I’ve seen credits in the movies, I always thought it was some Hollywood thing. Two cameras: close up on her, close up on him. The second unit was the the other one, ” I replied.

“We almost right,” he said. “When you see a movie of far away places, a french cafe, a turkish bazzar. They don’t really put the stars there. They are in Hollywood. They take the star stuff, mix it with the second unit stuff and it looks like the stars going places and doing things. Kind of a bummer for the star. The second unit gets to do all the fun stuff.”

He took a sip of his drink. “I’m putting together a team for a low budget flick. It doesn’t pay especially well, but you get to see the world.” When he turned back to me he was back to seeing the world with the one eye.

“What do you think. Want to join?”

Absurd, I thought. Then I thought of the library, my degree, my parents and all they offered.

“How long will it last?”

“Not long,” he said looking down at the bar, calculating. “Maybe three weeks.”

I thought: Three weeks was like a vacation. I could see the world while examining my options. I could tell mom and dad I had a job. The pressure would be off. It was perfect.

I stuck out my hand. “Deal?”

He turned back to me and looked at my hand a second.

“Deal, ” he said with a shake and firm grip.

“What do we do now?” I asked.

“Now,” he stuck an unlit cigarette into his mouth. “Now, we have a drink.”

***

  • * *

Black. All is black. Nothing, dark, complete. Feeling – gone. Memory – gone. Thought – nothing. Just black.

Rasssssp. Nothing, that is, but a scraping sound. Black nothingness devoid of purpose or intention. I wanted to wake and rejoin the land of the living, but the black had me. It was was like my entire being was chained to a floor. Black floor. Black chain. Heavy. Black is heavy. I tried to pull my conscience up and out of the black to…to…to…more black. There might have been movement, but I did not feel it.

Rasssssp. Black has an irritating way of allowing you to sink down toward the abyss. That is all you desire, yet you know there is something else there. It is the not black. I desired that too, and pulled on the black chain and tried to take the black with me. It moved a bit, but the effort was heroic.

Rassssp. My eyes snapped open and I raised my head with a start. The opposite of black flooded in and burst upon all my senses at once. With sudden intake of breath, intense pain radiated out of the center of my being. I closed my eyes to shield myself from the pain, to find the black again. It was dark, for sure, but the black would not come back.

I lay in that position for a few moments and concentrated on the important things, mostly to stifle the roar of the world. I was still shackled to the black. Deep down I was there. In the now, I was here. I was in two places at once and felt the tug of that heavy black chain. I felt like a drowning sailor, attached to a chain that would take me to the bottom of the ocean, and if I didn’t swim against the pull with all my might, I would perish.

I tried my eyes again. The light was not that bad. Head movement was the part that caused pain, so I looked around with as little movement as possible.

We were in a room like a small apartment. I was on a sofa. A blanket covered me. The bright was blinding, yet I struggled to keep my eyes open. I refused to succumb to the black any longer.

He was across the room in the kitchenette. In his boxer shorts and faded plaid flannel shirt, he was bent toward one of the drawers, steadying himself, peering in. He had a cigarette hanging limply from his mouth and he was muttering to himself.

“What are you looking for?” I asked raising myself up on one elbow.

“Light.”

I thought about the incredible brightness around me and wondered who would desire anything like that.

He stood and turned toward me. One eye half open, the other closed. With hooked hands he clawed toward his face.

“Oh, a light,” I realized he just wanted to smoke. I felt in the pocket of my jeans and fished out a lighter and held it out.

He focused and shoved his body away from the counter. He tottered toward me and snatched at the lighter. He caught it on the first try. In a single movement of his arm I heard, snick. He stood like a statue for a moment.

He inhaled deeply and closed his eye. He held his breath for a couple seconds then exhaled completely.

A couple seconds later he turned to look at me. The look was blank. He half closed the one eye and half opened the other, carefully maintaining the balance of light. In that moment I imagined the pieces of a jigsaw puzzle assembling themselves and falling into place above his head. As the last one fell into place, he said “Now, where were we?” he said expecting no answer. “Ah yes, we are collecting the team for an adventure. There is a lot to do, so we’d better get moving. ”

He reached down to the heap on the floor and tossed my fleece lined denim jacket at me. It landed softly on my face and I closed my eyes. I willed myself up. My head hurt, but the black was receding.

He turned and put my lighter into his shirt pocket and started poking around the floor for his clothes.

In the short time it took me to sit up and assemble myself, he had dressed, filled a small backpack with a few personal items. and gathered a pile of equipment into the middle of the room.

Hi cigarette became a nub, which he stubbed out at an ashtray on the kitchen counter. He shoved another into is mouth, patted his shirt for the lighter and lit again. He ran a hand through his hair to comb the stray ones down.

“All right. I think that is about it, ” he said and started to attach straps and lift bags.

I stood, accepted the kit and adjusted the balance of each item until the pile was distributed between us.

He opened the door and started walking down the hall. As I closed it behind me and followed, I thought I was forgetting something, but I couldn’t remember what it was.

I thought we’d be walking to his car, but when he set the bag down twenty feet from the corner, he stopped my question with, “its the bus for us.”

We stood there in silence. Within less than a minute of waiting, then looked at the time on his wrist watch, then scanned down the block to look for the approaching bus. Nothing.

He looked at his watch again, then started to walk away from the spot. He stopped me as I started to collect the pile of things that lay at our feet. Don’t trouble. I’ll be right back. He rushed off in the direction of the corner, then in a moment had disappeared.

I stood quietly. I looked up the street for the bus, then to the corner. Nothing.

Amid the street noise I stood. The last 16 hours had been a blur mostly, the colors of life smeared by alcohol. Three weeks! That sounded perfect, but here I stood at the same bus stop I had less than 24 hours ago before I met him. The only difference was…was…was….

A jumble of thoughts rolled through my head as I stood there. I could not say it was anything as concrete as a question or a conclusion. It was a gray misty swirl of the stuff between those two extremes.

Seemingly from nowhere a dog jumped through a nearby bush. I hadn’t noticed where is came from, I just heard the rustle of leaves as it jumped into the sidewalk, took a few silent steps toward me, looked at my face, then sat before me.

He was a dog of unspecified origin. His fur was soft, medium length and multi colored including a beautiful chest of snow white. His look was expectant. His mouth was open in a sort of smile. His tongue stayed where it belonged.

He sat, I stood, and we shared the moment. After about 10 seconds, he suddenly whirled around savagely and started biting the clump of hair at the base of his tail. There was a mashing sound for a small bit, then gentle licking to smooth the hair back down, then he turned again to look at me.

From down the street I heard the diesel motor of a bus and started to look around to catch sight of Quint. The street was full of dog, cars, and people walking, but the commander of my journey was nowhere to be seen.

I do not carry a wrist watch, but I wished I had a prop like that so I could look at it and make some sort of worried noise. I continued to look around as the sound of the bus neared. The dog never took his eyes off me.

The whirring sound of the bus warned me of its imminent arrival. I picked up the collection of things at my feet. Why is a mystery. I stood and looked to the corner again and saw just heads walking the other way. I looked back toward the dog, but it had disappeared.

As I gazed toward the bush of dog origin, the bus stopped and gave a loud hiss then a squeak of brakes that announced its arrival. The doors opened and people started to get in. I turned my my interest back toward the door as Quint arrived and grabbed one of the bags from off my shoulder.

Mutely, numbly I followed him onto the bus, where he paid for both of us and found a place where we could sit together with our stuff in a heap at our feet. The motor roared and we where thrown together as the bus accelerated into motion.

The sound of the bus in motion was loud and there was a fan on somewhere that made a forced air sound without providing any air movement. It was stuffy and close, and even with our equipment providing a buffer between us and others, I felt I was being smothered.

“Fair bit of luck getting this bus. ” he said looking about.

“Why?” I responded. Buses ran all day long, spaced out in a endless chain from morning through night.

“The number on the bus number was 23, two prime numbers with one being even. Very lucky,” he said with a grin. “I have a good feeling about today.”

“Why, last night you told me you had it all planned out completely. “

“I did and I do, but there are a few things we need to do first before we head to Portland. We have to get the script, a couple stunt people, and some other traveling supplies. I want to stay on schedule and it never hurt to have a little luck on our side. You wouldn’t deny us a little good fortune, would you?”

“Of course not,” I replied,” but after last night I thought of you as a we-make-our-own-luck kinda guy.”

“I am.” He winked, “but a little luck never hurt.” He put his head back, closed his eyes, crossed his arms and smiled to himself. I thought I heard him humming to himself as we rolled on.

Angular 2

nodejs is required (get to know npm)

command line is your friend.

Microsoft’s Visual Studio Code is pretty handy.

Typescript takes  javascript type structures, then compiles them

They say use webpack for distribution

Apps use model-view controllers. The controller is called a “component.” It ties a view(or portion of the whole view) to a tag.

tsconfig.json tells us what type of script to compile to – we use ES5, commonjs formats

app.component is the standard place to make the

Get Started with Angular 2 by Building a Simple Website

npm start

Component building:

CIDER

  • Create your class
  • Import your dependencies
  • Decorate your class
  • Enhance with composition
  • Repeat for sub-components

RC4 into RC6

Consolidates components


angular cli install

$ npm install -g angular-cli
$ ng new {app-name} --routing
$ cd {app-name}
$ ng serve

Using angular cli commands

Build a base class with unit test:

$ ng generate class {my-class} --spec

Build a service(business logic in a service):

$ ng generate service {my-service}

Gen a component(like navbar, sidebar, main-1, main-2, etc)

ng generate component {my-component}

Reports

A ragged, jagged nail caused annoyance. As her teeth and tongue grappled with the sharp unevenness, her brows furrowed.

Reports all have a life of their own. All reports are meant to communicate. They direct and teach. They issue warnings and edicts. They are devoid of empathy, sympathy; unable to sing. And Janice had seen more than her fair share. Her work exposed her to countless reports, some that reoccur like crop reports and missile silo allocation. Others are one-offs meant to provide a glimpse into the eternal.

Who wanted these reports? Mostly tax collectors, sometimes accountants and Occasionally politicians when they wanted to provide the imitation of science while manipulating a segment of the population.

Janice was none of these. Her training in psychology led her to the edge of a career in the medical professions. A chance, short affair, with a sly professor taught her more than she ever wanted about the nature of human beings.

People were messy, complicated, but not in a Sunday afternoon jigsaw puzzle sort of way, more like tsunami. After she learned people were motivated by a mere hand full of ideas, mostly fear based, her passion waned.

Reports aren’t dumb. But this one didn’t make sense. Janice eyes scanned for patterns, flaws, anything to help her mind make sense of what she was seeing.

But there were no flaws. The obvious was being stated with simple clarity. Aliens had landed in Nebraska and the government was exerting great effort to keep that information secret.

Stupid nervous habit she scolded herself while smoothing the edge using her teeth as a smoothing plane. A mere single page was not a conversation. It was merely a conspiracy theory dreamed up by paranoid idle minds. Her’s was not idle, nor paranoid – or so she thought.

It was like the back of the dollar bill only in reverse. The image on the bill contained the illustration of a pyramid with an invisible top. All that stuff building block upon block until…nothing. This report stated a single fact, floating above a plane. But where was the support? Invisible, yet it had to be there.

Aliens! Why not fairies and elves? America. Nebraska?! Why not Los Angeles, the land of the waking dream, or New York, the land of the waking nightmare. Betty and Barney Hill would want to shake her hand.

In an unusual move, she pressed the buttons that would generate hard copy. A finger pointing, guilty!

Play invalid sound, load one in the background

To start there is a “beep” while the real audio loads in the background.
1. In the game object put the audio.
2. Put an audio listener too.
3. Reuse the Collision trigger script that played the sound.
4. Extend it to load audio as coprocess.
5. When the audio loads, swap it in.

[script]
public class ClickButton : MonoBehaviour {
bool clicked = false;
public float elapsedTime = 0.0f;

// Use this for initialization
void Start()
{
StartCoroutine(LoadClip());
}
void Update()
{
if (clicked)
{
AudioSource audio = GetComponent();
if (!audio.isPlaying)
{
clicked = false;
var tmp = transform.position;
tmp.x += .08f;
transform.position = tmp;
}
}
}
void OnMouseDown()
{
var tmp = transform.position;
if (!clicked)
{
clicked = true;
tmp.x -= .08f;
GetComponent().Play();
}
else
{
clicked = false;
tmp.x += .08f;
GetComponent().Stop();
}
transform.position = tmp;
}
IEnumerator LoadClip()
{
WWW www = new WWW(“http://www.tonycuffe.com/mp3/tail%20toddle.mp3”);

while (!www.isDone)
{
elapsedTime += Time.deltaTime;
yield return null;
}

// TODO – look for errors, try again, etc.
AudioSource audio = GetComponent();
audio.clip = www.GetAudioClip(false, false);

yield break;
}
}

[/script]

Unity Tasty Tidbits

Move an object like a button press.

[script]
var tmp = transform.position;
tmp.x += .08f;
transform.position = tmp;
[/script]

Respond to a button click

On a an object with box colllider.
“Is Trigger” is Checked.
Add the following script…
[script]
void OnMouseDown()
{
var tmp = transform.position;
if (!clicked)
{
clicked = true;
tmp.x -= .08f;
}
else
{
clicked = false;
tmp.x += .08f;
}
transform.position = tmp;
}
[/script]

Survival Shooter – Chapeter 3 – Camera

Change the camera to follow…

Go to MainCamera

Change X,Y,Z => 1, 15, -22

Rotation -> 30,0,0

Projection -> othographic with size 4.5

Background Color -> Black

 

Script time…

Create a script called CameraFollow and edit.


using UnityEngine;
using System.Collections;

public class CameraFollow : MonoBehaviour {
public Transform target;
public float smoothing = 5f;

private Vector3 offset;

void Start(){
offset = transform.position - target.position;

}
void FixedUpdate(){
Vector3 transformCamPos = target.position + offset;
transform.position = Vector3.Lerp (transform.position, transformCamPos, smoothing * Time.deltaTime);
}
}

<span style="line-height: 1.5;">

Make sure it compiles and drag/drop it into the camera object.

 

Survival Shooter – Chapter 2

Add the main character, “player”

Open the models folder, find it drag-and-drop it.

Make sure he is centered at 0,0,0(origin)

Tag player as “player”

 

Animation controller. Move, turn, etc.

You will create a folder called Animation, in there create a  new Animation Controller called PlayerAC

Drag and drop that into the player.

Double click on the PlayerAC object to invoke the editor.

Now look at the player model and expand it.  There are some animations.  Drag and drop them into the Editor.

Make “Idle” the default. Right click, then “make default”, duh

Now we need to create the hooks so we can use these animations.  Create 2 new parameters.  IsWalking, Die

Now you can create some transitions that define how we logically go from one state to another.

Lets start with idle to move. Select idle, right click, choose make transition and link the event to move.  There is the link.

To edit the link,  click on it.  Then see the line.  Right click and find the Inspector.  Add the Condition IsWalking/True.

Make a reverse entry from move to idle with condition IsWalking/false

Since “die” can be called from any state,  create an event link from AnyState to Die.  Add the condition Die in the inspector.

That is it for now.

 

Back to char, add physics to our player – rigidbody(3d of course) and Capsule collider.

And of course sound. Add an audio source and the appropriate sound.

 

Move on to programming the movement.

You have:

FixedUpdate that runs on when rigid body moves

It calls three functions to do interesting things

Movement  – move our player

Turning — makes the camera follow the main guy around

Animating – set the “IsWalking” param of the animator we built above.

Because these programs were written for version 4, we can’t test the script until we fix the others.   Correct the missing references.

 

[script]
public class PlayerMovement : MonoBehaviour {
public float speed = 6;

private Vector3 movement;
private Animator anim;
private Rigidbody rb;

private int floormask; // raycast
private float camRayLength = 100f;

void Awake()
{
floormask = LayerMask.GetMask(“Floor”);
anim = GetComponent();
rb = GetComponent();
}

// physics update.
void FixedUpdate()
{
float h = Input.GetAxisRaw(“Horizontal”);
float v = Input.GetAxisRaw(“Vertical”);

Movement(h, v);
Turning();
Animating(h, v);
}
void Movement(float h, float v)
{
movement.Set(h, 0, v);
movement = movement.normalized * speed * Time.deltaTime;
rb.MovePosition(transform.position + movement);
}
void Turning()
{
Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit floorHit;
if (Physics.Raycast(camRay, out floorHit, camRayLength, floormask))
{
Vector3 playerToMouse = floorHit.point – transform.position;
playerToMouse.y = 0; // never leave the plane
Quaternion newRotation = Quaternion.LookRotation(playerToMouse);
rb.MoveRotation(newRotation);
}
}
void Animating(float h, float v)
{
bool walking = (h != 0) || (v != 0);
anim.SetBool(“IsWalking”, walking);
}

}
[/script]

Survival Shooter – Chapter 1

Start a 3d project

Find it  https://www.assetstore.unity3d.com/en/#!/content/40756

Load it into unity

Copy Environment prefab into scene

Copy lights prefab onto screen

 

We plan to use “Raycast” but don’t want to show on all the objects like the legos or the table.   [We know we are going to do something, but they arent specific.  Start by creating a quad called floor…]  This is the collider.

Create a quad – put it at origin, turn 90 on x.  Scale to 100×100

Name it “Floor”

Remove mesh-render component from floor.  You will see the collider (floor) outline.

Go to the properties window and at the top – change the layer to “Floor”

 

That is it for now.

 

Music

Create a blank game object and name it to background-audio

Add the component (audio source)

Use circle-select to pick the audio clip.

Unckeck – play on awake,

Check loop

Adjust volume to 0.1

 

 

Unity Space Shooter – Chapter 17 – Extending

Add new asteroid types

  1. Start by duplicating (2x) the asteroid object(drag from prefab) to scene.

 

  1. Customize each one by replacing the model with the alternates.
  2. Adjust the colliders.
  3. Rename and save as new prefabs.

Change the GameController to spawn all three

Change

public GameObject hazard;

to

public GameObjects[] hazards;

 

Change the spawn to select a random one from the list.

Remember to go back to the GameController Object and add those prefabs to the hazards list.

 

Star Field

Drag and drop the prefab starfield into the scene

Set the Y to just above the background.

Optionally fiddle with the lifetime and speed constants.

 

Rolling Cloud

Duplicate the Background as a child of background

Use the transform too. and Use vertex snapping(v) to get them butted from end to end.

This gives you two whole pieces to run.  The image is built to be seamless.

Add a new c# backgroundScroller script.  Not the mathf.repeat.  This is the key.

 

 

Enemies

So much

Create empty “Enemy” placeholder object and fill it with the model and exhaust model.

add rigid body and collider, then adjust.

Add movement compoent and make the value -5.

Add the destroy by contact component.

Make it a Prefab

Add the prefab to the gamecontroller’s list of hazards.

Run it.

 

Evasive manuver