Rainbow Games PHP Emoji Tutorial
โœ‚๐Ÿƒ๐Ÿพโ€โ™€๏ธ๐Ÿƒ๐Ÿผโ€โ™‚๏ธ
๐Ÿ“–

Rainbow Games PHP Emoji Tutorial

Rainbow Games PHP Emoji Tutorial

In order to take that further genericization step onto the achievements of yesterdayโ€™s Rainbow Games Genericization Tutorial to get onto (the mathematics Induction principle inspired) โ€ฆ

  • prove for the first case
  • prove for the second case
  • prove for the nth case

โ€ฆ we had a choice of โ€ฆ

  • continue on (with) the HTML code creation of new โ€œhardcodedโ€ arrays (managed by Javascript eval abstractional approach) โ€ฆ or โ€œbite the bulletโ€ and โ€ฆ
  • try to work out a generic โ€œemoji lookerer uppererโ€ arrangement

Guess you can tell we opted for the latter, huh?! We started the investigation of this by examining our three favourite emoji informational websites, namely โ€ฆ

  1. Emojipedia
  2. FileFormat Information
  3. Iemoji

โ€ฆ and were a bit surprised that we could not quite swing a generic method to glean the information, so donโ€™t know whether our new โ€œplayerโ€ is โ€œRingo Starrโ€ or not, but can tell you this, โ€œits beat is much better than its biteโ€ โ€ฆ chortle, chortle โ€ฆ

Emoji Terra performs similar functionality as Iemoji but has a permalink organization more friendly to an โ€œemoji search via emoji titleโ€ query, and that suits our purposes today, so, thanks a lot. Without this query by โ€œemoji titleโ€ possibility weโ€™d have been forced to adopt more of those โ€œhardcodedโ€ arrays, which would have been alright, but this second approach opens the door to โ€œsportโ€ events in โ€œThe Rainbow Gamesโ€ web application using emojis of the future (ie. they havenโ€™t been invented yet).

How to work the interfacing to Emoji Terra?

This new PHP emoji_lookupโšซphp treats the โ€œprove for the nth caseโ€ sports as ones to โ€ฆ

The more detailed specifics of the file_get_contents of Emoji Terra lookup above are โ€ฆ

  • build up a URL starting with HTTP://emojiterra.com/ โ€ฆ then โ€ฆ
  • in emojiland arrangements there are two genders (as our prefixes if you will) โ€ฆ woman- and man-
  • then add on a โ€œmiddleโ€ sport descriptor (eg. biking)
  • in emojiland emoticonland arrangements there are five descriptors (as our suffixes if you will) โ€ฆ -dark-skin-tone, -medium-dark-skin-tone, -medium-skin-tone, -medium-light-skin-tone, -light-skin-tone
  • for that set of 2x1x5=10 URLs glean what โ€œHTML decโ€ (HTML Entity) information you can glean via the file_get_contents call of the Emoji Terra URLs described above (eg. Emoji: Woman Biking: Dark Skin Tone) โ€ฆ built into a Javascript array string to โ€œplug intoโ€ the previously read HTML partner source code, and amended to output as the web page the user sees

Sports of the future in emojiland? Just ask for the equivalent of biking (above) off the user via a Javascript prompt window (on the proviso you read Conditional Alternative to Javascript Popup Windows in iOS Tutorial first please).



Previous relevant Rainbow Games Genericization Tutorial is shown below.

Rainbow Games Genericization Tutorial

Rainbow Games Genericization Tutorial

What would help genericize the recent Rainbow Games Double Transformation Tutorial โ€œRainbow Gamesโ€ web application? How about introducing another sport?

Again, in honour of โ€œonions of the 4th dimensionโ€ approaches, we mainly, turn to the power of Javascriptโ€™s eval methodology to achieve this abstracted feeling to our web application. Today, with this, we go two thirds of the way along the โ€œMathematical Inductionโ€ approach โ€ฆ

  • prove for the first case
  • prove for the second case
  • prove for the nth case

How does this use of Javascript eval manifest itself in this way?

  • there are two arrays that work with the โ€œcontentโ€ of our โ€œRainbow Gamesโ€ sport(s) (well, at least, the first โ€œsprint runningโ€ sport) called emoticons[] and choices[]
  • wherever we find references in the code to either of these two arrays we start to involve the global variable verbsuffix โ€ฆ


    var verb='Sprint';

    var verbs=['Sprint','Row'];

    var anotherverb='run';

    var verbsuffix='';


    โ€ฆ in altered ways like โ€ฆ


    function plus(ih,ihep) {

    var outihep=ihep;

    if (eval("emoticons" + verbsuffix + "[" + ih + "]").indexOf('<p>') != -1) {

    outihep += ' (' + eval("emoticons" + verbsuffix + "[" + ih + "]").split('<p>')[1].split('<')[0] + ')';

    }

    return outihep;

    }


    โ€ฆ in that abstracted way โ€ฆ noting that sometimes you donโ€™t need the โ€œeval()โ€ encasings โ€ฆ
  • and so, working through the code this way it just falls to the coder to define new members for all the arrays for all the new sports (ours is โ€œrowingโ€ today), some of those new arrays (like for rowing are emoticonsrowing[] and choicesrowing[]) to involve โ€ฆ
  • looking up emoji definitions from โ€ฆ
    1. Emojipedia
    2. FileFormat Information
    3. Iemoji

    โ€ฆ not forgetting to โ€ฆ

  • make sure the event logics work for multiple sport scenarios โ€ฆ but mostly they do by sticking to the principles above โ€ฆ especially for the โ€ฆ
  • new HTML select (dropdown) element allows the user to pick a sport

Remaining a work in progress, you can try out our liveโœ‚run link that has underlying HTML and Javascript and CSS emoji_walk_animationโšซhtm, and which changed in thisway regarding todayโ€™s genericization work. We hope it gives you food for thought.


Previous relevant Rainbow Games Double Transformation Tutorial is shown below.

Rainbow Games Double Transformation Tutorial

Rainbow Games Double Transformation Tutorial

We were on the โ€œroad to personalizationโ€ for the web application game we started with yesterdayโ€™s Rainbow Games Primer Tutorial when โ€œan old chestnutโ€ came up again. Itโ€™s happened before, the desire to โ€œdouble transformโ€ in CSS came about from our emoji โ€ฆ

๐Ÿƒ๐Ÿพโ€โ™€๏ธ

โ€ฆ table cell mirroring styling as per โ€ฆ



<style>

* { overflow-x: visible; }



select { font-size: 36px; }



td.runner { width: 50px; word-wrap: break-word; font-size: 36px;

transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1);

} //







๐Ÿƒ๐Ÿพโ€โ™€๏ธ

tr { max-height: 40px; }

</style>

โ€ฆ necessary to make our running emojis run from left to right (that, alas, also transformed any accompanying โ€ฆ

๐Ÿƒ๐Ÿพโ€โ™€๏ธ

Florence

โ€ฆ name), was added to in this double transformational clause to prove what this wonderful web page advice had to say. In other words, a โ€œdouble transformโ€ CSS styling scenario like the one below โ€ฆ



<style>

* { overflow-x: visible; }



select { font-size: 36px; }



td.runner { width: 50px; word-wrap: break-word; font-size: 36px;

transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform: scale(-1, 1);

}

tr { max-height: 40px; }



p {

display: block;

font-size: 12px;

-webkit-transform: matrix(-1, 0, 0, 1, 0, 0);

-moz-transform: matrix(-1, 0, 0, 1, 0, 0);

-o-transform: matrix(-1, 0, 0, 1, 0, 0);

transform: matrix(-1, 0, 0, 1, 0, 0);

} //







๐Ÿƒ๐Ÿพโ€โ™€๏ธ


Florence



</style>

โ€ฆ works as a โ€œdouble transformโ€ to first โ€ฆ

  • mirror (image) flip the table cell (td) emoji data โ€ฆ but us appending some โ€œRunner Nameโ€ textual data underneath also, annoyingly, got flipped until โ€ฆ
  • within that (same) table cell (td) element and after the emoji data we append an HTML p(aragraph) element to both โ€ฆ
    1. introduce a new HTML element type into the (CSS styling) mix โ€ฆ and to โ€ฆ
    2. introduce a new CSS transformation type, the matrix โ€ฆ perhaps either or both new parts to the problem critical to its success when, believe me, lots of other approaches donโ€™t work

โ€ฆ to personalize the โ€œrunnersโ€ and โ€œusersโ€, optionally, โ€œinto the gameโ€, by allowing the โ€œuserโ€ to name their โ€œrunnersโ€ and allow for a โ€œrunner energyโ€ setting be a bit randomized, to add for some other interest โ€œvarietyโ€ to the gameโ€™s workings. So, still a work in progress that you can try out at our liveโœ‚run link that has underlying HTML and Javascript and CSS emoji_walk_animationโšซhtml, and which changed in thisway regarding todayโ€™s work.


Previous relevant Rainbow Games Primer Tutorial is shown below.

Interesting Places Primer Tutorial

Rainbow Games Primer Tutorial

Itโ€™s been a while since weโ€™ve written any conventional HTML and Javascript and CSS game. Todayโ€™s game uses the โ€œemoticonโ€ section of the Emoji character set, defaulting so far, to the โ€œrunning womanโ€ emoji featuring in Compound Emoji WordPress Usage Tutorial.

Itโ€™s the early days of our โ€œRainbow Gamesโ€ web application, and weโ€™re starting with the animation featuring horizontal hashtag navigation techniques for a running race start to our game. Where it finishes? Hard to say! Today, weโ€™ve looked at โ€œsplitsโ€ and a finish line.

You can try out our burgeoning liveโœ‚run game concept link that has underlying HTML and Javascript and CSS emoji_walk_animationโšซhtml.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Games, Tutorials and tagged , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *