Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
How’d They Do It? PHPSnake: Detecting Keypresses
Oct 31, 2016 @ 20:14:23

The SitePoint PHP blog has a new tutorial posted from editor Bruno Skvorc looking at building a "snake" game purely with PHP and handling/catching keypresses.

At a recent conference in Bulgaria, there was a hackathon for which Andrew Carter created a PHP console version of the popular “snake” game. I thought it was a really interesting concept, and since Andrew has a history of using PHP for weird things, I figured I’d demystify and explain how it was done.

The original repository is here, but we’ll build a version of it from scratch in this series so no need to clone it.

They start by defining some of the requirements for the game, including that it is to be CLI based with no browser functionality allowed. With those defined, they get into the code, starting with some of the "boilerplate" code to work with the command line environment, handle output and reading in characters as keys are pressed. The tutorial then gets into mapping the snakes to "directions" do that the keypresses would make the snake go up, down, left or right.

tagged: phpsnake snake detect keypress tutorial commandline

Link: https://www.sitepoint.com/howd-they-do-it-phpsnake-detecting-keypresses/

Zend Developer Zone:
AJAX Chat Tutorial Part 7 : Usability Improvements
Jan 15, 2007 @ 17:38:00

The Zend Developer Zone has posted part seven of their series covering the development of an Ajax chat application. This time,. they're focusing on some of the final touches - usability improvements.

To start we need to make the chat messages automatically refresh at fixed intervals without requiring user input. We will also add a small message to let the user know when a background request is active. To finish up we remove the necessity of using the "Say It!" button to submit new chat messages.

They show how to make the chat window refresh at an interval (rather than manually), how to have the application tell the user it's doing something (like "loading"), and adding a keypress event to handle the user pressing the enter key to send off their message.

tagged: ajax chat application tutorial usability improvement refresh feedback keypress ajax chat application tutorial usability improvement refresh feedback keypress

Link:

Zend Developer Zone:
AJAX Chat Tutorial Part 7 : Usability Improvements
Jan 15, 2007 @ 17:38:00

The Zend Developer Zone has posted part seven of their series covering the development of an Ajax chat application. This time,. they're focusing on some of the final touches - usability improvements.

To start we need to make the chat messages automatically refresh at fixed intervals without requiring user input. We will also add a small message to let the user know when a background request is active. To finish up we remove the necessity of using the "Say It!" button to submit new chat messages.

They show how to make the chat window refresh at an interval (rather than manually), how to have the application tell the user it's doing something (like "loading"), and adding a keypress event to handle the user pressing the enter key to send off their message.

tagged: ajax chat application tutorial usability improvement refresh feedback keypress ajax chat application tutorial usability improvement refresh feedback keypress

Link:


Trending Topics: