TwistyWristy

Last Login:
February 08, 2011
Warn:

Rank:
Member


User Profile
Follow

Hits: 19,529
Joined December 14, 2006
Favorite Users


The Rise and Fall of Internet Memes
Posted on April 20, 2010 at 09:06

O Hai,

The internetz is a fascinating thing.
It has connected millions of people around the world. It has given us the ability to access billions of pages of information. But most notably, it has given us YouTube. YouTube purveyor of awsum vids is the proud record holder of the most viewed video and webpage ever with it's big hit — Yo Numa Numa's great and imma let you finish but Rick and Ashley's Groovy Penguin Avenue is the best video of all time. The argument over which of these two videos is better is a battle fought fiercely and anything but Swift as it has been raging on for nearly a decade.

Everyone's got there own opinions on the matter, from geeks and grandparents to single ladies and celebrities. The aggravating thing is, YouTube knows perfectly well which video is more popular but refuses to tell anyone. When I tell this to people, their eyes usually grow wide and they cock their heads to the side and exclaim O RLY?

YA RLY.

Being the 7334 Haxxor I am I decided to hack into YouTube's servers and get the information myself. After an hour or so I was proud to say I hacked 127.0.0.1 and was in but unfortunately, some uber noob called Leeroy Jenkins was simultaneously attempting to hack into the server and he triggered every sort of alarm YouTube had in place and then some. My screen went black replaced with the bold white letters FAIL. While I was infuriated, I was also hoping that the feds didn't come knocking and I wouldn't end up screaming "don't tase me bro".

Besides media, the internet has played an instrumental role in children's education. Prior to the internet kids sucked at geography. Seriously they sucked. At the peak of suckage, a NASA computer ran the following simulation thirty years in the future and came up with the following results: A hostile alien race landed on Earth. After declaring the following statement "All Your Base Are belong to us" they attacked. The leaders of the world, children who had previously in their lives experienced Geography Fail, had no idea where to send the troops or war planes.
They simply could not get the names and locations of the countries straight. Right now you're probably thinking, "*faceplam* Oh great, earth gets wiped out because kids don't know geography. (choice expletive here) my life. But before you despair know that thanks to the internet there is hope.
In a recent interview, a teacher proudly showed off her classes knowledge. "What is this?" she asked, pointing to a map upon which the kids proudly roared "THIS IS SPARTA!". No hesitation what so ever. Go home E.T.

Another great thing about the internet is that it has done wonders for food. P.E.T.F. member Marcus Fuller said that thanks to the viral nature of the internet, the percentages of banana consumption have dropped drastically. "Without the internet, our advertisement would've never spread as far as it did. But it's everywhere, people uses it as avatars and it even comes as a default smiley on some sites." While P.E.T.F. may be pleased, it's sister organization on other foods, was not. "Bacon?" Matt Simpson said angrily before calming down and sighing "hmmmm. I really don't feel like getting in to that right now." For other foods the internet has done wonders for, +1 to anyone who thought of cookies. On the other hand, never believe anyone who says the internet has had a profound effect on cake; it's a lie.

Soo nwaoieasdfg iwanoer... Sorry about the typos and excuse me for a second while I grab my cat who is on my keyboard, trying to type and — stuff. You may LOL but you're not the one who has fur all over their keyboard.

So I think we can all agree that the internet is a pretty epic thing and we should all greatly thank it's inventor, Chuck Norris. That's right, Al Gore, according to myth invented the internet when it was in fact Chuck Norris. Fortunately, you didn't believe this myth, otherwise Chuck Norris would have pwned you and you'd no longer be here.

KTHXBYE



Something dumb and slightly amusing I wrote late late last night... I'd love to hear what you have to say and I know you love to comment, so I put a comment in your comment box so you can comment while you comment.

TwistyWristy



Modit: Lern2format
Phantom Mod edit: Learn2Spell
Modit: Dude, it's a meme
TwistyWristy Edit: Phantom Mod GTFO; Mod =D




TW - The Human Factory
Posted on August 24, 2009 at 09:02

What's up 64D?

Here's something I wrote a few days ago.
It led to an interesting discussion and I'd thought I'd post it here as well to get more opinions and thoughts.



"Welcome to the Human Factory where we make perfect our practice!"

A heavyset man dressed in a cream colored suit greeted the small gaggle of students debarking from the bus.

"I'm Alexander Martin, CEO of The Human Factory. Come along and I'll give you the tour."

He led them down a slick marble floor and up to a glass door.

This is our birthing room or what we like to call the 4F room, where we make sure all embryos are pure and clean.

"Sir, what do you mean by pure and clean?" a boy asked, waving his hand in the air.

"Well Timmy, with our patented technology, we can check ahead if any embryos are carrying any genetic defects or if they will be prone to diseases.
This way, parents never have to worry about their child having any problems."

Susie raised her hand. "I have asthma, does this mean my parents would've gotten rid of me?"

The CEO laughed. "No sweetheart; you would still be here, just a different version of you, a version without asthma. That's a very good thing!"

Susie frowned, "But if I didn't have asthma, wouldn't I be a different kind of Susie?"

"Yeah," David added. "Susie wouldn't be much fun if we couldn't tease her about her inhaler and pretend she was Darth Vader!"

Pausing only momentarily to glare at David, Susie continued. "I can't really go outside and play because of my asthma, so I stay inside and do a lot of reading instead.
If I didn't have asthma, isn't it true that I might be outside a lot more and that I wouldn't learn as much as I do now from reading?"

"The world would be a better place" The CEO thought but instead he smiled uncomfortably and chose as an alternative,

"Well asthma is not really what I was talking about anyway. I was really referring to birth defects and such."

"My older brother has Down Syndrome but he's one of the sweetest people in the whole universe." Mary-Ellen declared. "And he's real good at drawing too, I wouldn't want to get rid of him for anything!"

"For the love of-" the CEO started angrily. "This isn't about getting rid of anybody - it's about preventing these things from happening in the future.
There won't be any older brothers or - or any you's " - here he gestured, slightly rudely towards Susie - "to know about and wonder what they would be like because they won't exists anymore! It's not a destructive thing it's just like a cure, only we're preventing something instead of fixing it."

Several more hands went up but the CEO wasn't having any of it.

"Let's move along to our next section. Now, this is the crowning jewel of The Human Factory, a room we like to call the Perfectatorium.
Here, we've tested combination upon combination of different genes as we strive to make the perfect human."

"Imagine sight so sharp, you won't be caught off guard by the fine print ever again" he joked, his spirits obviously feeling lifted again.
"Superior speed, smooth, clear skin, breathtaking beauty, unparalleled intelligence, electrifingly sharp senses, ..." the CEO's excited fervor died down instantly as Susie raised her hand again.

"I suppose you have another question?" he grumbled disdainfully, trying and failing to keep the testiness out of his voice.

"Don't some of these perfections conflict? I mean, is it possible to make someone both really fast and a really high jumper at the same time? Don't they require different leg structures?"

"I-I'm sure, I mean I KNOW that our engineers have it under control." the CEO smiled through clenched teeth.

"Sir," Another student, David raised his hand.
"You mentioned breathtaking beauty but don't people have different ideas of perfect beauty? My friend John thinks Lizzie is really pretty but I sure couldn't disagree more"

While the CEO internally seethed with apoplectic rage at these inquisitive children, Lizzie blushed, looking pleased and angry at the same time.
Buying a few moments to think on the pretense of stopping Lizzie from hitting David as her anger beat pleasure, the CEO started talking, another false smile plastered on his face.

"An excellent question," he falsely smiled, though his tone clearly implied that he thought otherwise. "Beauty, when you think about it, is really nothing more than another mathematical forumla, which our scientist and mathematicians have quantified, derived and perfected."

"What's Lizzie then, a zero?" David cracked.

This time Lizzie DID hit him and the CEO took full advantage of the ensuing scuffle to usher the kids into a different room.
His relief was short lived however; before he could explain the new room, Susie thrust her hand in the air, determined not to have her questions ignored this time around.

"Sir, I still had a question about the Perfectatorium. If everyone is perfect, wouldn't everyone be exactly the same and if everyone were the same, wouldn't it be true that no one was faster or stronger anymore?"

"No!" the CEO snapped vehemently and his brain sighed wearily, forced to forge ahead and scrape together a reason to backup his claim as to why she was wrong.
"You see little girl," he stalled ever so slowly, "The reason why you are wrong, is because you aren't really looking at the whole picture. If two spaceships can both move faster than the speed of light, aren't they both still fast?"

"Nothing moves faster than the speed of light", Susie corrected automatically and with the man bristling she continued, "You mean that perfection is relative?"

"Relative!" the man seized on the word with some relief. "Yes, exactly, I see my example helped you to understand."

"But..." Susie said, frowning with confusion "If perfection is relative, why are you trying to make perfect people?"

"I don't expect you to understand, you are only a silly little girl" he hissed savagely under his breath.

The science teacher, who had been watching her students grill the CEO with great personal enjoyment chose this moment to step forward.

"I'll thank you not to have the audacity to assume the level of intelligence and comprehensibility of my students especially someone such as... well never mind." she trailed off the implications of an insult hanging heavily in the air.

Glaring, the man cleared his throat. "What I meant to say was that we do not focus solely on making perfect people.
If you'll all come to this very next room in fact..."

"Now as you all know," he continued, the students grudgingly following him through the next door. "Jobs such as construction, digging, manual labor basically, can be harmful and even fatally dangerous.
That's why we've created specialized humans! Taking the risk, so you don't have to!"

"Why are they all black?" Danny asked bluntly.

"Oh. Oh! No, no, no, no!" the CEO stammered smoothly, a skill obtained from constant practice . "I know what you're thinking son but absolutely not. We here at The Human Factor pride ourselves in our diversity!"

"There's nothing very diverse about the people down there," Mary-Ellen said quietly.

"No, no, no," The CEO repeated assuring, rather attempting to assure them hurriedly. "Really, some of my dearest and closest friends-"

"Shut up," Danny said angrily. "Who are you to tell these people they have to do manual labor jobs, that's slavery!"

"It is not!" The CEO said just as angrily. "If YOU had shut up and bothered to let me finish explaining, I would've told you that these people have been genetically engineered to want to work.
They have no intelligence, no creativity or free will, they were not taken against their will and they are not treated with cruelty."

"It's wrong!" Lizzie snapped, stamping her foot.

"How can it be wrong if they have no emotions or feelings no tolerance for pain?" the CEO snapped back.

The students fell momentarily silent and triumphantly the CEO swept off to a different room, the class storming behind.

"This... is what we call the Miracle room." the CEO said with a dramatic sweeping gesture.

Despite being upset and angry, the kids could not help but be awed.
Millions, billions it seemed of sparkling crystal spheres filling the room from floor to ceiling and they wouldn't have been surprised if it was called the miracle room simply due to the fact that somehow the stacks did not fall over and send small glass shards shooting all over the place.

"Here we can cure cancers, here, we can give the beauty of a summer day to the blind, here, we can give the well worn forest trail to the paralyzed!" the CEO stated grandly, relishing in the vision his own voiced invoked so was therefore quite annoyed when he opened his eyes and saw Susie whispering to the other students.

"Sir?" Timmy asked curiously. "How did you obtain so many of these?"

"Well, we harvest some of them from the rejects of 4F-" the CEO stopped, regretting the words as soon as they left his mouth and sure enough...

"I knew it you horrid monster!" Lizzie yelled. "Your killing innocent babies!"

"Don't you start, that's a bunch of your moral crap!" the CEO snapped.

"You could a good dose of morals, you stupid jerk!" Lizzie snapped back angrily.

"I will not stand here and be called names!"

The CEO rounded furiously upon the science teacher, who through applaudable effort, fought down the smile threatening to take over her face and said, "Lizzie, you shouldn't use emotions in a debate, scientific or otherwise."

"This is not a debate!" the CEO spat, so angry he failed to realize the science teacher hadn't actually told Lizzie not to call him names. "This is a tour of a wonderful, majestic, breathtaking factory and you kids fail to realize, fail to appreciate the cutting edge science, the raw power, the good of everything that is done here! This tour is over!"

"Why don't you use a different technique than one that destroys human embryos!" Susie asked as the CEO lead them back to their bus.

"It cost too much" The CEO snarled. "This is a business you little brat and profits don't know anything about morals and ethics."

"How come you can't have hot super models doing construction work instead?" Danny asked suddenly.

"That's a stupid idea, other people especially women might find it - " The CEO froze and cursed under his breath.

"Degrading!" Danny yelled gleefully, his point well made.

"Wrong!" Timmy added.

"Incredibly Hot?" David joked, and Lizzie hit him again.

One more stairway, two more doors and I am rid of this miserable kids forever. The CEO though aggressively. In his mind, he called the kids several cuss words and felt better.
This feeling didn't last long.

"I've been thinking..." David started and Lizzie looked at him warily.
"Earlier you said those people who you created to do manual labor and dangerous jobs didn't have any free will, and feelings or emotions or sense of pain. Well sir, I was wondering how can you be sure that they don't, what if you're wrong? And even if they don't isn't it still wrong for us to treat them that way?"

The CEO stared at him stonily and Lizzie hit David.

"Hey!" he said angrily. "I thought I said something good for once."

"Sorry," she apologized. "Force of habit, you know?"

Completely ignoring the question, the CEO wheeled about and stormed back towards the doors of the human factory.

Talking angrily amongst themselves, the children filed on to the bus, all pulling out laptops.

"Hey!" The bus driver said, polishing off the last of the bucket of wings he had been eating. "You know the rules, no playing games on the bus' internet connection!"

"No need to worry about that." the science teacher smiled, pointing to the monitoring screen.

Every laptop had some kind of blog or email open, all containing the words The Human Factory.

"So you kids must have really enjoyed the tour!" the bus driver chuckled, setting the bus in gear. "That clone of mine, I'll tell you, he's something amazing."

TwistyWristy




TW
Posted on May 04, 2009 at 14:56

Hey, what's up 64D?
What's happening, what' going on?

It's been quite a while since I've posted... I came to see what everyone was up to about half a year ago, but the server was down; and it continued to stay down when I tried again later =(
Anyhow, it's nice to see the place didn't die after all (as I thought when the server was done) and to see a few old members are still here.
Even nicer still to see two PM's that have been sitting here since August 2008. Lovely, just lovely.
Fortunately, after reading them, I found I was also contacted about the contents outside of PM's as well.


What have I been up to lately?
Besides being awesome, which you know already:


-Writing-

Writing a 100+ page Animorph Fan Fiction for my siblings.
They liked it but I'm not pleased with the final result; probably because I replaced the darkness for humor.
Displeased to the point that I haven't put it on any FanFiction sites until I give it a do over and who knows when that could be? Plus, part II still needs to be written.

A 5-8 research report with accompanying video presentation for my LCTA course. (Holds up 'audience disappointed' cue sign)

A parody of The HitchHiker's Guide to The Galaxy based around the cyberworld.

Posting in several discussions about the economy.


Random

- Created a bot cooler then Ciribot.

- Expressed my frustration that the Flyers and Sixers are both out of the playoffs

- Became a secret agent


New Laptop + Decent Internet
As you may or may not know I've suffered with a 28- 40 KB internet connection for quite before moving on to a better and yet so much worse satellite connection.

Now I've got a sweet new USB modem from Sprint.
5 GB of bandwidth, decent speeds, and works just about everywhere except on the path through a forest on the upmost peaks of a really sharp curving mountain range (yes this really happened...don't ask, though you probably will anyway).
No rolling bandwidth cap, no contract B.S. and complete mobility.
It's got a few neat features such as GPS; it would be perfect if it was capable of receiving text messages but a talk with Sprint and probing the AT commands (and seemingly messing up the modem for a heart-stopping moment in the process) revealed that it was impossible.

The laptop, a Toshiba Satellite, 17" Widescreen, 3 GB Ram, 3.3 GHz Dual Core processors, 250 GB Hard Drive, an ATI Radeon... er, four digits something labeled graphics card.
Not a bleeding edge, top of the line graphics card of course but Empire Earth has never looked so beautiful.

And if I had some time, you guys would get destroyed in Sapphire Tears (is that game still running strong?) and Adrenaline.
I mean, if I did pretty good on a crappy dial-up connection, well... let's just leave it at consider yourselves lucky. >=p


64tdq.com
A site I create a little while ago to help out with tuition and bills. Feel free to contribute and ask a question!
Or if you could Stumble, Digg it, etc. I'd appreciate it.


Art
I started sketching a little bit more and finally decided to take the time to study the human anatomy, seemingly changed my mind a few minutes later, but those few minutes have resulted in better human poses and figures.
I do like the eyeballs I've been drawing though, Animé style.

In the never ending debate between whether Photoshop or MS-Paint is better for drawing between my siblings and I, I put together a surprisingly not bad head (for a five minute job):










If you don't see the image, use your imagination and imagine something spectacular... it's on a different computer so I can't upload it right now =p

If imagination isn't your strong point or if your mind is stuck in an endless loop on the girl sitting next to you in class (despite your thoughts being multi-threaded) then here:

a thousand words

On the other hand, they are doing some making some amazing pixel art good, game-quality stuff.
We're supposed to be making a game one of these days when I get the time.


Make Some Cash!
(Previously the subheader was going to be entitled "Make Some Money" but it brings to mind that annoying oovoo commercial...)

Mostly what I've been doing and the reason I've been so busy is I've been doing freelance coding projects on rentacoder.com to help cover tuition.
I've got a decent ranking (10/10, #3,429 and in the top 1.5 percent of coders on the site).

Anyway, I get invited to a lot of projects due to my good ranking, far many than I can take on at once so an idea I've recently had (and am currently implementing) is to refer these projects to additional people.
Here's how it works:

If you, the beloved reader, posses any of the following skills:

- PHP
- ASP
- Java
- Javascript
- AJAX
- MySQL
- VB.NET
- VB
- C++
- C#
- Python
- Ruby on Rails
- iPhone Development

- CSS
- Flash
- Logo Design
- Vector Art
- Website Design

- Wordpress
- Drupal
- Joomla

- Unix Server Skills

- Ninja Skills
- Unlisted Skills

If you are reasonably good with aforementioned skills and if you let me know you are interested, I can send you the project specs and the payment you'll receive; if you like the project I can open communication with the buyer and if all goes well, they'll accept.

After the work is done and the buyer accepts it as 'complete' I mark down your share. As soon as rentacoder pays (usually earlier than the 7th and 22nd of each month), I'll send you your payment via PayPal!

Questions?

TwistyWristy




The Answer To Life, The Universe and Everything
Posted on May 17, 2008 at 15:54

42




TW - 64 Things to Do While 64's Down
Posted on June 10, 2007 at 20:30

Firstly, check out my previous blog for information about joining two team projects. Previous Blog

64 Things to do while, 64 Digits is down

A list of 64 Things to do while are beloved 64Digits is down, a few serious, most silly.

1. Join a Project[
2. Write an ultra long blog post on what you've been doing during the downtime.
3. Barricade yourself in your room and retreat into a shell for five days.
4. Create 65 Digits in 5 days
5. Take a dip in the neighbor's pool
6. Eat 64 scoops of Ice Cream
7. Amass a stockpile of funny YouTube videos
8. March outside with the best intentions to annihilate the entirely too tall grass taking over your lawn.
9. Chill in the shade, drinking lemonade when your best intentions fail.
10. Take a minute to reflect on your life
11. Try to remember as many 64digit users you can off the top of your head...
12. Count 432000 seconds which is 5 days, unless you happen to be a picky geeky person who insists that days are actually 23.59xxxx hours long, until you realized the time spent calculating the actual number of seconds in 5 days will make the count even longer than it should be...
13. Discover that there is surprisingly, more to the World Wide Web than 64Digits
14. Discover that there is surprisingly, more to the Actual World than the computer
15. Take your girl or guy on a really romantic and special date.
16. Make a game so awesome that the queue is hardly worthy of its awesomeness.
17. Learn that you really have five fingers, not 64, and spend the 5 days learning to count in Base 10.
18. Hold imaginary conversations with 64Digiters.
19. Get abducted by aliens.
20. Read a few books...
21. Film an action movie with a few friends and your trusty video camera.
22. Download 100+ songs, torrent half a dozen new games
23. Embarrass yourself so badly so we all have something to laugh about when the site comes back up and you blog about it.
24. Get a decent amount of sleep.
25. Camp out in front of your computer waiting for 64Digits to come back online, like one of those StarWars movies
26. Go to the amusement park.
27. Play B.O.T.S
28. Tape together 25 pieces of paper (5 x 5) and draw a huge adventure map.
29. Defrag your computer, backup your files, upgrade some memory, etc
30. Watch all three Matrix Movies in a row
31. Make a 64Digits calender, all 365 days with famous (or infamous) quotes and avatars from various 64digit users,
32. Redecorate your room.
33. Create a tasty new snack...
34. Take a shower (hopefully that's every day).
35. Put one of your dreams into action.
36. Get your learners permit
37. Get punished for two weeks, and wind up waiting 9 extra days for 64Digits.
38. Spend all day composing a song and the next day, hear it on TV.
39. Learn to do back flips and stuff at flip-cast.com
40. End up in the hospital when a trick goes bad (try not to do this okay?)
41. Make $500 dollars
42. See some awesome new technologies on one of the Discovery shows
43. Stop getting cheese curl gunk on the keyboard.
44. Smile. At everyone you make eye contact with.
45. Pick up a virus and unwittingly spread it through the 64Digits community when you excitedly post what you've been working on the past five days.
46. Pick up a virus and knowingly spread it throughout the 64digits community when you nefariously post what you've been working on the past five days.
47. Suffer a mental breakdown
48. Build an awesome Lego or K'Nex structure that brushes the ceiling.
49. Connect all the speakers in the house together to deliver the most thoroughly loud, floor shaking, bone rumbling sounding music.
50. Get visited by the police when the neighbors complain.
51. Get sick because you ate an entire cake you were taking over to the neighbors out of spite.
52. Visit the museum.
53. Make an avatar for everyone on your favorite users lists.
54. Complete 100 Sudoku puzzles...
55. Write a short story.
56. Design a new website.
57. Stay on flashchat all the time.
58. LEARNZ LOLCODE (Am I going to regret posting this link...)
59. Write your own programming language and write a parser for it.
60. Do what you usually do, because you are not dependent on 64Digits *applauds*
61. Spread a new phrase throughout the entire internet. By the time everyone gets back together, they should know it, somehow...
62. Miss spamming every blog there is
63. Suddenly hit a hot streak in Sapphire Tears... and the scoreboard is down.
64. Have so much fun doing other things, that you completely forget about 64Digits and never come back =(

This actually got easier to write the further I went down... I thought it'd be the other way around.

I'd be steamed if the server went down before I got to post this... let's hope that's not the case...

Have fun and see you in five days, if not on flashchat or elsewhere!

TwistyWristy




TW - 'Emotions' RTS Tutorial 1
Posted on January 17, 2007 at 08:11

This material is Copyright 2007 Sheldon Allen

This material is intended for your personal use only.
You do not have permission to copy it, redistribute it or profit from it in anyway without written permission from the author.
Any included files and their content, may be used for any non-commercial purpose.
Contact the author for information regarding commercial use.


Emotions RTS Tutorial - 1


Previous Part (Intro)

Included Files:
Editable .gm6 file

Welcome to the start of the 'Emotions' RTS Tutorial.

For the first few lessons, we will be building up a basic infrastructure for the engine/game, things that are needed for almost any RTS.
It's a pain having to wait for the 'real' stuff, but once we get the basic stuff together, we can really get to it!
Also, because we're building up the infrastructure, some of the code really isn't something to discuss.
It will be more of a code dump with lots of commentation and will talk about a few of the more interesting things.

The focus for today will be selections.

There's many different ways to select and deselect units:
- Click Select
- Drag Select
- Shift to Add Units
- Ctrl to Deselect Units
- Hotkey Select (0-9)
- Double-Click Type Selection (Select Units of the same type/class)

The main part of selecting and deselecting units requires getting the mouse code together.
Basically, there are two choices for deciding on how to handle the input.
The first way is to use the built-in mouse events and the second is to code our own mouse handling routines.

While the first method is undoubtedly faster than coding everything ourselves, we will still have to add code ourselves for dragging and double-clicking, all spread out through several events.

If we do things ourselves, everything is in one script, one place.
It's not any harder than using the built-in events, once we know the right functions we need.
Since all the code is in one place, it's much easier to make changes to everything.
We also gain greater control over the input...
Later on, it'll be easier to implement mouse sensitivity, swap mouse buttons and other such mouse settings.

So, we are going to go with option two;
if you still want to use events, you'll have to tweak things a little to work...

Before we get started with the coding, let's setup a few sprites to represent the units as well as setup some objects.

First, we'll need three objects for the units.
The first is called obj_unit, and will be the parent of all other unit objects.
The other two are called obj_unit_happy and obj_unit_mad.
Set them both to their respective sprites and their parent to obj_unit.

Now, the only reason we need three objects is because we have no way to differentiate between the units without using the room creation code to set a variable and it all gets to be a big mess.
We'll have a World Creator later, so using three objects will do for the time being..

The code for obj_unit is very simple.
In the create event we initialize a few variables:

obj_unit Create Event
Quote

selected = 0 // Whether the unit is selected or not
direction = 270 //The direction the unit is facing
image_index = direction/360*image_number //Display the correct sub-image


The end step is used to choose the correct sub-image:

obj_unit End Step Event
Quote

image_index = direction/360*image_number //Display the correct sub-image


Finally, in the Draw Event, the actual unit is drawn, as well as a ring if selected:

obj_unit Draw Event
Quote

if selected{
draw_set_color(c_red)
draw_ellipse(x,y,x+50,y+25,false) // Draw an Ellipse under the unit (looks better than a circle)
//draw_circle(x,y,50,false) // Draw a circle under the unit
}

draw_sprite(sprite_index,-1,x,y)


Bam! No problemo, right? (I hope. [GRIN])

With the units squared away, it's time to get to the selection part.

Now, the first step is to keep track of the state of the mouse buttons.
A mouse button has several states:

Double Clicked (Clicked twice)
-Clicked (Pressed and Released)
-Pressed (Held Down)
-Released (Let Go)

The state of these buttons can be determined through a combination of variables and the various mouse button functions:

mouse_check_button(button) // is true as long as button is pressed
mouse_check_pressed_button(button) // is set to true once on the first press of the button.
It is then set to false, and will not be re-triggered until the mouse is pressed back down.

So basically, all we need to do is test if the left mouse button is pressed using mouse_check_button_pressed(mb_left) in conjuction with several variables such as global.pressed, global.released, etc., and we'll have the mouse code squared away.

Like I said earlier, there's not much to discuss; I think it's best to just have a look at the code yourself.
Before we get buried under a pile of code, let's take a quick look at how we'll keep track of the units.

The method that I find extremely useful is to use list structures to store all of the units.
There are eleven lists, all stored in a global array from 0 to 10 (global.unit_list[0...10])
The first (0th) holds the currently selected units, while the other ten are used for hot-groups (0-9 on the keyboard).
I find it much easier to handle the units using lists rather than an array, or a selected variable, not to mention much faster
It will also come in handy later on if we want to make a little mini-bar for the units (like in Empire Earth), or any other time where need a quick reference to the unit.
We can just look through the list instead of all units...

Alright, let's get the rest of this code setup. To the dump, dump, dump...

First up, make a new object called obj_controller, responsible for spawning all other controller objects, and initializing the game:
Quote

// Initialize all constants for the game
scr_constants() //Setup Constants
instance_create(-1000,-1000,obj_input_controller) //Create other objects in code so the room doesn't look a mess
//Unit List
for (i=0;i<10+1;i+=1){
global.unit_list[i] = ds_list_create()
}


Now, I don't know about you, but I hate adding Constants to the game.
It's messy, inconvenient, no way to re-order it, etc.
For the most part this is fixed in GM 7.0 by use of adding a constant script as an extension, or by just using a global (since variables no longer have 'global.' in front of them).
Until that happy time, I'll continue using globals as constants.

Script scr_constants
Quote

//------------------------------------Constants-------------------------------

// Mouse
global.pressed = 1
global.released = 2

// Hotkeys
global.shift = 0
global.control = 0
global.alt = 0


Technically, global.shift, global.control and global.alt aren't constants.
Shh... I won't tell if you don't.
Anyway, those three variables will store the state of their respective keys.

global.pressed and global.released actually are constants, used for the state of a mouse button.

Now, to code the very last, and very biggest object, obj_input_controller.

First up in the create event, we initialize some variables, with a call to the script, scr_init_input:

Script scr_init_input
Quote

// Initialize mouse

// Buttons
global.mouse_left = 0 //Left Button State
global.mouse_right = 0 //Right Button State

//Dragging
global.mouse_drag = 0
global.mouse_drag_x = mouse_x //The starting x coordinate for a drag
global.mouse_drag_y = mouse_y //The starting y coordinate for a drag

// Clicking-Hovering
global.click = 0 // Whether the mouse has been clicked
global.click_id = -1 //The id of the instance last-clicked by the mouse
global.mouse_over = - 1 //The id of the instance the mouse is hovering over

//Double-Clicking
global.double_click = 0 //Whether the mosue has been double-clicked
global.double_click_time = 200 //Time allowed for double-click
global.mouse_click_timer = current_time + global.double_click_time // Tracks time left to double-click


It will make more since if we move the global.shift, global.control and global.alt 'constant' out of scr_constants and move them into scr_init_input.
So let's do that, sticking it at the top...

Now, in the begin step event, still of obj_input_controller, we make calls to three more scripts:
Quote

scr_get_input()
scr_check_selection()
scr_check_hotkeys()


The first script is responsible for getting the input.
We check all of the mouse buttons and their various combinations and store the results in one or two variables:

Script scr_get_input
Quote

// Clear out old mouse states
global.double_click = false //Clear double-click state

if global.mouse_drag = 2{ //Released Drag
global.mouse_drag = 0 //Clear drag state
}

if current_time > global.mouse_click_timer{ // Clear Double-Click State (too slow)
global.click = 0
}

if global.mouse_left = global.released{ // Clear Release State
global.mouse_left = 0
global.mouse_click_timer = current_time + global.double_click_time
}

if global.mouse_right = global.released{ // Clear Release State
global.mouse_right = 0
}

global.mouse_over = collision_point(mouse_x,mouse_y,all,true,false) // Object Mouse Hovers Over

//Clicking - Left Button
if mouse_check_button_pressed(mb_left) && global.mouse_left !=global.pressed{ // First Press
global.mouse_left = global.pressed // Set mouse state
global.mouse_drag_x = mouse_x // Set Drag X
global.mouse_drag_y = mouse_y // Set Drag Y
if global.click = 0 and global.double_click = false{ // Single-Click
global.click = 1 //Set click state to single-click
global.click_id = global.mouse_over // Instance receiving click
global.mouse_click_timer = current_time + global.double_click_time //Start timer for double-click
}else if global.click = 1{ //Test For Double-Click
global.click = 0
if current_time < global.mouse_click_timer && global.mouse_over = global.click_id{ // Double-Click
global.double_click = true
}
}
}

//Clicking - Right Button
if mouse_check_button_pressed(mb_right) && global.mouse_right !=global.pressed{
global.mouse_right = global.pressed
}
//Dragging
if global.mouse_left = global.pressed && global.mouse_drag = 0 &&
point_distance(global.mouse_drag_x,global.mouse_drag_y,mouse_x,mouse_y) > 5{ //Test for drag
global.mouse_drag = 1
}
//Releasing
if !mouse_check_button(mb_left) && global.mouse_left = global.pressed{ // Releasing Left Mouse Button
global.mouse_left = global.released
if global.mouse_drag = 1{
global.mouse_drag = 2
}
}

if !mouse_check_button(mb_right) && global.mouse_right = global.pressed{ //Releasing Right Mouse Button
global.mouse_right = global.released
}

if global.double_click = true{ // Clear the mouse after a double-click
mouse_clear(mb_left)
}


The first thing that we want to do is clear out several previous mouse states.
Releasing the mouse, the first press of the mouse, Double-Clicking, etc.
All of these only last for one step before being cleared.

The bulk of the code is where we check if the left-mouse button is being pressed for the same time.
If it is pressed, we also set the starting drag coordinates, as well as start the timer for double-clicking.

Finally, we check if the mouse is being dragged, or release.
For the dragging, we allow a mouse_zone of 5 pixels to give the user a little room.

Whew! In the next script, scr_check_selection, we check if the units are being selected.
Basically, we check the global.mouse_over variable to see if the mouse is even over anything.
If the mouse is over something, we check if it's a unit (later on, we'll have to add a check to see if it's a friendly unit).

After that, it's a matter of if statements, checking whether it's a click, double-click, or drag select, and whether shift(Add-unit) or control (Remove Unit) is pressed:

Quote

if global.mouse_over{ // If the mouse is over anything
if object_get_parent(global.mouse_over.object_index) = obj_unit and global.mouse_left = global.pressed and !global.mouse_drag{ // If the left mouse button is pressed and over a unit
unit_id = global.mouse_over // Set the unit_id to global.mouse_over
global.unit_type = unit_id.object_index // Get the type/class of the unit
if !global.double_click{ // Single-Click
if global.shift{ //Shift-key held
if !unit_id.selected{ //If the unit hasn't already been selected
unit_id.selected = 1
ds_list_add(global.unit_list[0],unit_id) //Add it to the list
}
}else if global.control{
if unit_id.selected{
unit_id.selected = 0
ds_list_delete(global.unit_list[0],ds_list_find_index(global.unit_list[0],unit_id))
}
}else{
ds_list_clear(global.unit_list[0]) // Clear out the unit list
with(obj_unit){
selected = 0
}
unit_id.selected = 1
ds_list_add(global.unit_list[0],unit_id)
}
}else{ // Double-Click
if global.shift{ // Add units to Selection List
with(obj_unit){
if !selected and object_index = global.unit_type{
ds_list_add(global.unit_list[0],id)
selected = 1
}
}
}else if global.control{ //Remove Units from Selection List
with(obj_unit){
if object_index = global.unit_type and selected = 1{
selected = 0
ds_list_delete(global.unit_list[0],ds_list_find_index(global.unit_list[0],id))
}
}
}else if !global.control and !global.shift{ // Clear List and add new Units
//mouse_clear(mb_left)
ds_list_clear(global.unit_list[0]) // Clear out the unit list
with(obj_unit){
selected = 0
}
with(obj_unit){ //Reset all units selected variable to zero. Should actually run through list
if object_index = global.unit_type{
ds_list_add(global.unit_list[0],id)
selected = 1
}
}
}
}
}
}else if global.mouse_left = global.released and global.mouse_drag = 0{
ds_list_clear(global.unit_list[0]) // Clear out the unit list
with(obj_unit){
selected = 0
}
global.click = 0
}
if global.mouse_drag = 2 and global.mouse_drag_x !=mouse_x and global.mouse_drag_y !=mouse_y{ //Released
x1 = min(global.mouse_drag_x,mouse_x)
y1 = min(global.mouse_drag_y,mouse_y)
x2 = max(global.mouse_drag_x,mouse_x)
y2 = max(global.mouse_drag_y,mouse_y)
// Check for units
// Any objects belonging to player get selected
if global.shift{
instance_deactivate_region(x1,y1,x2-x1,y2-y1,false,true)
with(obj_unit){
selected = 1
ds_list_add(global.unit_list[0],id)
}
}else if global.control{ //Remove object
instance_deactivate_region(x1,y1,x2-x1,y2-y1,false,true)
with(obj_unit){
selected = 0
ds_list_delete(global.unit_list[0],ds_list_find_index(global.unit_list[0],id))
}
}else{
with(obj_unit){
selected = 0
}
instance_deactivate_region(x1,y1,x2-x1,y2-y1,false,true)
ds_list_clear(global.unit_list[0])
with(obj_unit){
selected = !selected
ds_list_add(global.unit_list[0],id)
}

}
instance_activate_all()
}



Finally, the last script, scr_check_hotkeys, checks if any hotkeys are pressed.
Right now we only have the number 0-9 for hotkeys:
Script scr_check_hotkeys:
Quote


var j,iid;
//Hot-Keys
//048-057
if keyboard_key >=048 && keyboard_key <=057{
global.group = 9 - (57 - keyboard_key) + 1 // Number of Hotkey pressed. Add one to amount because '0' is default list
if keyboard_check(vk_control){ //Create Group
ds_list_clear(global.unit_list[global.group])
for (j=0;j<ds_list_size(global.unit_list[0]);j+=1){ //Loop through current list
ds_list_add(global.unit_list[global.group],ds_list_find_value(global.unit_list[0],j)) // Add selected unit to specified list
}
}else{ //Select group
if !keyboard_check(vk_shift){
with (obj_unit){ //Reset Selection to 0
selected = 0
}
}
ds_list_clear(global.unit_list[0])
for (j=0;j<ds_list_size(global.unit_list[global.group]);j+=1){ //Loop through List
iid = ds_list_find_value(global.unit_list[global.group],j) //Pull Id from list
ds_list_add(global.unit_list[0],iid) //Add unit to default list (0)
iid.selected = 1
}
}
}


For the hotkey script, we check if one of the number keys is being pressed, and if so, copy the list to the default one, selecting the units along the way by setting selected to true.

Something to watch out for...
If you use show_message() in the script (which I was, to make sure there were no off by one errors with the groups selecting) it clears out the keyboard and mouse states.

This makes sense, but when I tried to store the keyboard_key in a variable before calling show_message() it still wouldn't work properly!
I have no idea why and am still trying to figure out the cause and I'd be gratified if you dropped me a line if you know.
So to summarize, I sacrificed a half and hour of my life, and am valiantly warning you now so you won't do the same. [GRIN]

Just two more pieces of code!
The first one just gives us something to test out with the units
If we press the left or right arrow keys, selected objects will spin around:

obj_input_controller begin step event
Quote


if keyboard_check(vk_left){
//Spin left
with (obj_unit){
if selected{
direction -=10
}
}
}
if keyboard_check(vk_right){
//Spin left
with (obj_unit){
if selected{
direction +=10
}
}
}


And last, the code to draw the selection box.
This goes in the draw event by the way:

obj_input_controller Draw Event
Quote


if global.mouse_drag{
draw_set_color(c_blue)
draw_rectangle(global.mouse_drag_x,global.mouse_drag_y,mouse_x,mouse_y,1)
}



Place obj_controller in a room along with a few units and give it a spin.
Voila! Hopefully, everything runs smoothly and you can select and spin units around.
If not, I tremendously hope that I didn't ruin any code.
I checked over everything but there's always that possibility that I missed something, and if that turns out to be the case, feel free to let out your aggravation at me.[GRIN]
Remember that you can always take a look at the source files as well.

I hope you've found this tutorial useful, or you've learned something new.
Next time, we'll be working on a HUD and scrollable view...

If you have any suggestions, comments, or ideas, for future tutorials, send me an e-mail at
rtstutorial at gamedevguru.com (Replace 'at' with @ sign)
You can also send me a PM, or post a comment and I'll get back to you as soon as possible!

Until then,

TwistyWristy




TW- Strike!
Posted on December 21, 2006 at 08:22

Here's a Christmas poem I wrote the other day.
Enjoy!


T’was the Strike



‘Twas the night before Christmas
and all through the shop,
not an elf would hammer,
paint, wrap or chop.

The elves were on strike
and would not lift a hand,
until Santa was prepared
to meet their demands.

‘What’s this?’ cried Santa,
as soon as he heard.
You’re going on strike?
Why that is absurd!

Now come my good elves,
there is no time to waste!
To make it before Christmas,
we must move with haste!

One elf stepped forward
and in a loud ringing voice,
‘We’re quite sorry Santa,
but you’ve left us no choice.’

For hours we toll,
with hardly any sleep ,
we’re working for pennies,
we can’t live so cheap.

But that’s merely a fraction,
of all our dismay,
and you’d do well to listen,
if you want us to stay.

There was a long pause,
Santa’s mouth a thin line.
He crossed his arm’s tightly
and snapped out ‘Oh, Fine’.

The elf unfurled a scroll,
and taking a deep breath
stated quite clearly,
‘We of the E.T.F’

‘Hang on’, Santa interrupted,
holding out his hand.
You said ‘E.T.F’,
for what does that stand?

The Elf Treatment Front,
Santa was shortly told.
Designed as a balance,
against the power you hold

At this Santa scowled,
but by the elves he was dismissed,
as the E.T.F. Leader,
read the first item from the list

Every year, Mrs. Claus…
Oh the goods that she bakes!
We’re sick of you getting it all
and demand 50% of the take!

Santa sputtered incoherently,
his face red with rage.
‘50% of the goodies,
you’re out of your cage!

You can all pack your bags,
your demands are plain dumb.
Get out of my sight,
you’re not getting a crumb!

The elves blinked in shock
The talks were a bust!
They had never expected,
Santa to cause such a fuss

An elf said hesitantly
’25 percent? Only 1 out of 4?’
Santa gave him a cold look,
and jerked a thumb at the door

The elves started leaving,
some haughty, some sad.
But then, Mrs. Claus came,
and boy was she mad!


‘Stop’ she commanded
and the elves froze in place.
She turned towards Santa,
a finger jabbing his face

It’s the season of sharing
you old stubborn fool.
And you mean to tell me,
you won’t share a cookie or two?

When millions of children
can unselfishly place,
a snack of milk and cookies,
for you to stuff your face?

Santa bowed his head sorrowfully
While Mrs. Claus aimed her glare,
at all of the elves,
who shivered slightly in fear.

And as for you elves
why you ought to be slapped!
Unions and wages
and all of this crap!

You know we can’t pay you,
though I’d think it enough,
to see happy faces ,
as kids get their stuff!

No more raging over cookies,
no complaining over pay.
It’s Christmas Eve people,
let’s load up this sleigh!

For a moment no one moved,
then stepped forward an elf,
who hesitantly began labeling,
gifts from off a shelf.

It took only one
before the rest leapt into action.
Mrs. Claus broke into a smile,
nodding in satisfaction



Gifts were being wrapped,
bows tied in elegant knots.
The sleigh loaded with goodies,
past enmity forgot.

And then it was done,
the sleigh loaded, ready to go.
Several elves dragging it ,
outside in the snow.

Santa thanked all the elves,
and kissed his wife good-bye.
Then hurried outside,
to hitch the reindeer to his ride

But reaching the sleigh,
the reindeer weren’t in their place.
Instead facing Santa,
with smirks on their face

‘Oh no!’, groaned Santa.
‘Honey, Come quick!’
He yelled for his wife,
over demands for salt lick.


TwistyWristy



Prev Page | Next Page

Recent Activity
 
Active Users (0)