Posts Tagged ‘demo’
22nd Dec 2008
Well how could I not create a little Flash Christmas demo?
Click the present to open.
Music taken from an Atari ST demo by Baggio. Icons by Delekt. Code by me. Packaged for you. (it’s 500KB so let it load.. and apologies if it grinds on slower browsers / PCs)
Happy Christmas everyone.
21st Oct 2008
squize and ngfx of Gaming Your Way infamy have released a lovely little Flash demo called 651: Announce. It’s a typically old-school demo but with a lovely modern feel to it. squize pumps out the polys with some smooth PV3D sections (you ought to try Away3D mate!) and while the different parts feel slightly disjointed (few transitions from one to the other) they each stand up well in their own right. From pretty rotating plasma, to gunmetal spheres and the neat voxel landscape trip right at the end, this is well worth watching.
Oh and squize: Thanks for the greets and I was glad to see you got this released! Surprised you managed it so quickly given how you admitted you like to procrastinate about these things rather than do them
You’ll need Flash Player 10 to view it: http://blog.gamingyourway.com/content/binary/index651.html
16th Sep 2008
sergej wrote a comment to my BlitzMouse post saying that if you right-clicked the custom pointer gets lost until the page is refreshed. Here is some simple code to work around this.
In your main SWF make sure you import ContextMenu and ContextMenuEvent. Then add 2 new global vars:
private var rightClickContext:ContextMenu;
private var contextOpen:Boolean;
and within your init (or constructor) add this:
rightClickContext = new ContextMenu();
this.contextMenu = rightClickContext;
rightClickContext.addEventListener(ContextMenuEvent.MENU_SELECT, contextMenuOpen, false, 0, true);
“this” is a Sprite in this case, but any valid display object (that has access to the contextMenu) will do. The “contextMenuOpen” function is literally just the following:
private function contextMenuOpen(event:ContextMenuEvent):void
contextOpen = true;
and finally, in your main game loop, just check the state of this var and reset accordingly:
if (contextOpen && mouse.isDown)
When the context menu is opened (by a right-click on Windows) it fires the ContextMenuEvent.MENU_SELECT event, which we capture and set a boolean for accordingly. While the menu is open we can do nothing about the standard mouse pointer, but in our main loop we can listen out for a mouse click (mouse.isDown) and then hide the pointer again accordingly.
I’ve not tested this on a Mac (where you can command-click to get the context menu up) so if anyone reading can do so, please let me know if it works.
The SWF below should allow you access to the context menu, but upon clicking the SWF again the custom pointer should return (assuming you click within the limit zone!)
15th Sep 2008
After working my butt-off on my latest game I decided it was time to redirect some love and attention to PixelBlitz. So this weekend I finished off a new class I had planned out a while ago. Introducing… BlitzMouse! This pairs up with BlitzKeyboard to complete the input set, and is a feature rich (and very fast) mouse handling system.
Here’s a very simple demo of it in action:
Press the cursor keys to limit custom mouse pointer movement.
So what can this bad boy do? The aim (as with all things PixelBlitz) is to make working with the mouse in your games easier. Here’s a quick overview of the core features:
Accurate mouse tracking
Keep an eye on that rodent! Easily check if it has left the stage, or re-entered again. Doesn’t use any CPU time processing events that require the mouse if it’s not over the stage!
Button / Click handling
Detect when the mouse button is down, or up.. or being held down. Find out how long it took the user to make that last mouse click (the speed from down to up again). Find out how many clicks the user has made since you last checked. Writing those god-awful “Ninja Finger” style games has never been so simple 😉
Want to know if the mouse is moving up? Just check isMovingUp! You can poll all 4 directions easily and quickly. Want to know how far in pixels the mouse has travelled on the X axis? Call distanceX() – want to know how fast it moved? Call speedX!
To know which angle the mouse is at call angle(), and you can have the result back in degrees or radians. Use the optional “lowerAccuracy” parameter and it uses a much faster calculation, but sacrifice a little accuracy in the process (great for a quick arcade game, not-so for a physics simulation).
You can set the point of the angle calculation (it defaults to the centre of your stage), which allows you to track the angle from anywhere to the mouse. You can even get the angle from any display object to the mouse using angleToObject() (with all the same parameters that angle() supports). This means if you want 3 things all pointing right at the mouse then it’s no problem! (see the demo above) Want to know the distance from any display object to the mouse? Call distanceToObject() and it’ll tell you.
Custom Mouse Pointers
Use changePointer() and you can set the mouse pointer to any display object – with custom X/Y offset support incase the pointer needs aligning differently to the standard top left. As the mouse moves, the display object is updated. If the mouse leaves the stage the display object is made invisible, so you don’t get that “cursor stuck on the edge” problem
Want to limit the movement of the custom pointer? No problem! You can limit it in all four directions (up/down/left/right) with optional snapBack support on both axis. For example if you were making a Pong game (please… don’t) by just calling limitMovement(true, true, false, false) you will lock the bat into only moving up and down with left/right movements ignored.
Want to limit the mouse to a specific area of the stage? Call limit(new Rectangle(x,y,w,h)) – if the mouse goes outside of this zone it will be hidden from view. You can see this in the example above as it hides when it leaves the light grey box. This limit also effects custom pointers. Of course when the mouse leaves the stage there is nothing you can do about that – but we have to work within the limits of Flash here
So there we have it – BlitzMouse! Hopefully more useful than you thought when you first read the title, aye? I plan to add more features, such as custom events/function calls on mouse actions, the ability to attach as many display objects as you like to it (so they all update at once) and custom zones, so you can have as many “mouse zones” as you want. The code is uploaded to Google, so enjoy
30th Aug 2008
Just a small update to the PixelBlitz Engine today, but a pretty cool one!
I’m creating an intense shoot-em-up game as my water shed test of the PB engine. Each day I get to add a few more features to PB that makes the game closer to reality. Once I have reached that point I know we’ll have something truly useful on our hands
Today I added in a backdrop behind my ships and thought “damn, that ought to scroll” – but I figured that PB ought to handle the scrolling for me, automatically – just set it and forget it. So that is what I’ve added to the engine tonight.
It’s a piece of piss to use:
// Continuously scroll this PixelSprite to the left by 4 pixels per frame
Which allowed me to create the following demo in around 20 lines of code:
I’m quite pleased with how this is shaping up You can autoscroll any PixelSprite, with full transparency preserved (so they can be overlaid on-top of other PixelSprites for true glass-window scrolling effects). The PB engine takes care of making the scroll seamless for you, and you can modify the speed on-the-fly (although I’d recommend not to do it every frame if you’ve got a lot going on).
The only issue is that scaling an auto scrolling PixelSprite will mess it up, so I’ll need to remedy that.
It’s now the weekend, but if i get some spare time I plan on continuing my task of fixing the left over issues before cracking on with collision groups and sprite mask tests.
All about Photon Storm and our
HTML5 game development services
Filter our Content
- Cool Links
- Flash Game Dev Tips
- Game Development
- Geek Shopping
- In the Media
- Phaser 3