Wednesday, February 12, 2014

GET EXCITED, I'M DOING THINGS. (JavaScript, HTML)

So some CRAZY THINGS have been going on and I've been pretty busy.. but now things are calming down significantly and I'm going to have a lot more time to devote to code.. (I probably sound like a broken record... I've said this so many times..)

every day i'm shufflin' -- shufflin' -- shuff -- shufflin' -- shufflin'

Anyway, the last post I made was about a balloon-popping game I was going to be working on with Ian (Mac-Daddy) the web-ninja. Well, I finally got around to it.

What Ian gave me was a little base code to work with.. basically a stage where red dots would pop up in random locations. If you clicked the dot, it animated and "popped" and added a point to the bottom of the page.

There were some buggy things we fixed together.. for example, if you clicked really fast on a "balloon" while it was "popping", it would register multiple points.. not good.

Anyway, after fixing some things I started ADDING some things! Now, there are the beginnings of a "lives" system, where instead of playing until time ran out (lame) you play until you suck too hard (swallow it).

gulp

You (will be able to) lose lives by not popping balloons fast enough. To combat you being REALLY CRAPPY and losing all your lives, once in a while a heart will pop up in the staging area. Inside the heart will be a random letter (A-Z, not cAsE-sPeCiFiC) and if you type that letter in-between popping balloons, the heart will burst and you will get another life to play with (max of 3 lives).

Here's a stunning and visually dynamic preview of the game IN ACTION (without my mouse cursor because screenshots don't dig mouse cursors):

fucking fantastic

Soon, everyone will be able to pop some balloons! I don't know if I can do a "high score" board or anything, so until then, I'll probably have you guys email me screenshots of your super high scores. Yay.

Thanks for reading! #n00bc0d3r #yolo #swag

Wednesday, January 15, 2014

Pop mah motha-fukkin balloons! (HTML, JavaScript)

Howdy folks! It's me, the n00bc0d3r, back to tell you about some n00bc0d3 I am trying to muster up the strength to work on.

My good friend Ian yelled at me and told me to make a website. So I have, kind of, the beginnings of a little website (look at how awesome it is in this screenshot):


I AM TOTALLY A L337 W3B D3$IG|\|3R!

Anyway. One of the pages (I'll have to add it to the nav bar up top) will be a little balloon-pop game! Ian has already made a huge chunk of it.. a little box that spawns divs in it at random locations, and when the user clicks on a div it has a little pop "animation" and then you get points.

The divs spawn constantly every 2 or 3 seconds about. If you leave it alone, I'm sure the entire window will just be full of little "balloon" divs.

What I'd like to make happen with this game:


  • As each balloon is popped, the time between balloon-spawns decreases slightly.
  • Balloons that are not popped within double the time that they take to spawn are DESTROYEDDDD and the player loses one life. Lose 5 lives and game over.
  • Over time, the chance for another div, a little heart, to pop up in the background that awards the player one life (max 5 lives) will increase. The trick to getting this extra life is not to click on it, but to type in the appropriate letter on your keyboard. The letter will be shown inside the heart.


That's all for now! I haven't even begun trying to tinker with what Ian has already made because I took one look at the code he wrote and was like "I HAVE NO IDEA WHAT THIS SAYS WHAT IS THE POINT OF MY LIFE"


I'm sure I'll figure it out eventually.

Sunday, January 5, 2014

Personal Home Page Hypertext Pre-Processor (PHP)

That's what PHP stands for. It's an acronym inside of an acronym.

PHP

PHP


PHPHP

Personal Home Page Hypertext Pre-Processor

I ALREADY DON'T LIKE THIS.

Saturday, January 4, 2014

Done with Dash!

Well I know I didn't post for a while because I was being a silly billy, but I've finished Dash.

I figured summarizing literally everything I do in each dash tutorial was kind of cheap and annoying so FUCK THAT NOISE. I'm done with Dash and you bitches can deal with it!


I can't say I'd recommend Dash to a friend, because I walked away from it not knowing much. Sure, I did a lot.. and it was easy to kind of understand what was going on when I was doing it, but I didn't retain much from Dash. All of it was written right there in front of me. "Oh hey, type this exact thing in. You're such a 1337 c0d3r."

But it was nice to do! And a good starting point. I think I'll pay my husband Bucky Roberts a visit and look at this HTML5 TUTORIALS because his content is always enjoyable. Also did I mention he's a cutie?


Oh yeah babi.

Anyway, much thanks to my friend Ian for introducing me to dash and getting me started with html. For now I'll go back to fiddling around with code academy I suppose! Also I need to get another set of flashcards so I can drill syntax and all. Woohoo.

Bye guyz.

Wednesday, December 25, 2013

Relative positioning and animations for my laser robot! (HTML, CSS, JavaScript)

Howdy everyone! This will be a short blog post because Ian is STARING AT ME and I feel obligated to rush.

So, last time I made a lovely robot out of divs. Well, I did that by stacking (literally) a few divs on top of each other and centering them to make a robot. That's pretty simple, but in order to have that robot move around on the page, its position needs to be relative to the edges of the page, not just centered in the middle of it.

By applying position: relative to the divs, I can move them around by using left: right: top: bottom: and giving pixel numbers to push them from those sides of the window.

While those move my robot pieces in two dimensions, I can also layer the pieces in the 3rd dimension, z-index: by using positive or negative numbers. If a blue circle has a z-index: -3 and a red circle has a z-index: 0 (which is the default, even if you don't apply a z-index) then the blue circle will be BEHIND the red circle.

Z-index does not scale the size of the elements. Also, if there is no declared z-index and two elements overlap, the one closest to the bottom will be shown first. (There's that cascade again!)


So here the wheel of my robot was moved up a little and given a negative z-index to be behind the torso. Also I made two other divs (inside the torso div) that contain J's, and rotated them and flipped one and pushed them behind the the torso. Woohoo.


As you guys can see above, I gave the right arm a special font, flipped it on it's Y axis (scaleY(-1)), rotated it, added some vendor prefixes for the whole "transform" thing, and then did other stuff to move it into place.

We also contained the pieces of the robot in one big robot div, and nested the divs for the arms in with the torso div:


BAM.

Now to animate those eyeballs.

Cotter, who is now much uglier than I remember, is yelling at me for his lasers. Those eccentric millionaires just don't know how to chill out..


So to do this, we're going to use an @ rule called keyframes. What @keyframes does is it modifies the state of something for a period of time, and then sets it back the way it was. We'll use this to modify the white glowy-eyes of our robot to become red for 50% of the time, over a duration of .5 seconds (.25 white, .25 seconds of red) that will loop for forever.

In order to do this, we need to define the keyframes rule and then assign it to the element it will be affecting.
Here is my definition of the keyframes rule, we've called it "blink":


Had to add in a bunch of vendor prefixes to be safe and make sure that it runs on all browsers.. but here's the breakdown of the syntax...
50% of the way through our timeperiod for the keyframe (which we'll define later, when we actually assign the keyframe), the background will take on the aspect of having a circle red gradient.


Above, I've assigned the animation "blink" to the brain div and given it a 0.5s time period and an infinite loop. This will modify the background of the brain div (the eyes) to be what we define in the animation (red) for 50% of the time (0.25 seconds) and to blink for FOREVER.

Cool. But Cooter--I mean Cotter still isn't happy. He wants to be able to turn the lasers on and off, not just have them shooting out for forever. I guess I get where he's coming from.. so we'll cover how to do that in the next blog post!

For now I need to go make some COOKIES. <3 bye="" christmas.="" guys="" merry="" p="">

Tuesday, December 24, 2013

Cotter loves robots. (HTML, CSS, JavaScript)

Here I am on my last segment of the Dash courses!
For this segment, my client is an eccentric millionaire named Cotter. He likes robots.


I'd be Cotter's best friend, because he looks kinda cute-ish maybe and he also has a lot of money. But alas, I am not anywhere near being a robot. Yet.

To please Cotter and provide a nice foundation for asking him if he'll be my sugar daddy, I'm going to have to learn about making shapes with HTML and CSS. Ian already had me so an exercise where I made a box that flashes back and forth between blue and red if I click it, but this may be more intense.

I'm also going to learn more about borders, and gradients, and background-size stuff. Sounds fun. LET'S GET TO IT.

So, by default a div is three things.. invisible, a rectangle based on the size of its containing element, and sexually frustrated. In the past, I inserted things into the div (color, text, pictures) to sate its burning desire to fornicate. This time, I'm going to shape divs and rub them all against each other in some softcore-porn-esque way to make them look like a robot.

...is it getting warm in here?


So since divs are born rectangles, it takes a little convincing to get them to loosen up and stop being so straight and just be a circle for a day or two. We do that with alcoho--I mean with border radius! Adding a border radius adds curves to your div. 

I just assuming that whatever value you give the border radius, it will reach out to the border and say "okay, from the center of the element, the border has a radius of this" and that makes sense to me. If you set border radius to one value, then you get something that's completely rounded. If the border radius is at least half the length of the shape, then you get a circle. 

The syntax is border-radius: top-left top-right bottom-right bottom-left; so if you only give some of the corners a radius to work with, you'll only have those parts of the rectangle rounded out. Simple enough.


Trapezoids are a bit more complicated. Because they have sharp edges, we don't use border-radius for something like a triangle. Instead, we move the border around the div.

Step 1: Make a div with some size (a size of 0 works, too)
Step 2: Add border thickness and color/transparency to create a shape that emanates from the div (which is invisible because it has no color).

Here's an example of a trapezoid I just made and some explanation below:


The div itself has no height, and a width of 140px. If it had no width, the middle square part would be gone and this would be a triangle.
The top border extends upwards 300px. Technically, the div's location in this picture is the very bottom border of the trapezoid. It has the 140px width and is invisible.
From here we create borders to the left and right of the div. Because there is no border on the BOTTOM of the div, the border on the sides stretches straight out from the center of the div, and connects to the top corners of the div. The color is transparent, so it kind of cuts triangles out of the div which would normally be a square.

Here's another illustration of the div (hooray MS paint skills):


My drawings should be in the fucking MoMA. 

Adding curves to the corners of this would let you shape it even more! I'm sure you guys could imagine the number of phallic divs I'm making right now.. tee-hee.

So I've done some fiddling and some rounding of edges and now I have a robot body, a wheel it rolls around on a-la the maid in The Jetsons, and a nice little head-shape. What he needs are glowy eyes. "How are the eyes going to be glowy?" you ask as you hang my illustration of my div above your mantle in your den... well I'll tell you how... RADIAL GRADIENTS.

Pop some radial gradients into the background and BAM, you got a big eye in the middle of the div. Adjust the background size of your (invisible) div, and the radial eye will start repeating, making two eyes! Or four! Or ELEVEN MILLION.

I'm not going to show you guys radial gradient things because this post is long enough.. but here is the syntax:
radial-gradient(shape, centercolor, outercolor);

In this case we made the shape circle, the center color "white 15%" and the outercolor "transparent 40%".. the percentages correlate to opacity so it makes it look more glowy.

Woohoo! After adding another little div to make an antenna, stuff is looking like a robot!


Hooray. Should put a Santa hat on him considering that it's Christmas eve... maybe later.
Anyway, the robot needs to do more stuff! It will start taking commands, moving its arms (which are yet to exist) and blinking its laser eyes. Exciting.

More to come.

Wednesday, December 18, 2013

Media Queries, the If-Then of the web! (HTML, CSS, JavaScript)

I love me some if-then statements, and media queries are what's up in CSS with that!
Here's the syntax for a media query:


Within the brackets are the condition that you're testing.
If that condition is TRUE, then the statements will execute on the elements of choice.
For example....


Above, when the page width is less than 501px, the font-size of h1 (header 1) is set to 50px.


FUCKING AMAZING. Remember to add your media query at the bottom of your style tags. Since CSS does "cascade" downward, you'll screw yourself if somewhere later in the style tag you modify what your media query is modifying. CSS pays attention to the modification that is closest to the bottom of the tag, so that's where you want your conditional formatting.

Anyway peeps I just got back from WINNING PUB TRIVIA, HELLZ YEAH, so I'm going to bed.
n00b, out!