$12256 / $11500
I've been heavily involved in the development of an HTML5 space shooter over the last few months and was wondering, what is the most natural way to implement touch input for a space shooter? Right now I have pretty natural keyboard and mouse inputs setup but touch input is just not natural at all. You can see what I have so far here.
The way I do it is to 1. make shooting automatic, and 2. create an invisible object that jumps to the touched position, which the ship moves toward. The ship's handling is as easy as adjusting the speed at which it moves toward that position. Which you could then change dynamically with powerups (if you're so inclined!)
One consequence of this is that bullet SFX get kind of annoying. So you might want to use a dull, low tone, or only play a sound when they hit.
And if you don't mind my making a suggestion, if you want really fierce enemies, you should take four things into account: 1. how long an enemy comes in, and from what angle, before 2. settling into their form of attack (like flying in a circle for example,) then 3. how close and how long they'll move toward the player while also performing that pattern, and 4. when and how they'll break off their attack and fly off-screen. The helicopters from Raiden are a great example - they fly down from the top, hang for a few seconds while shooting the player, then, if they weren't shot, fly back up and exit the screen at the position from which they entered. In a vert, enemy AI is everything. Or even consider the Zanac series, that had a controller which would adjust the difficulty in response to the player's style of play. Bullet AI should follow a similarly complex pattern, although their designs tend to be more abstract. But imagine the gulf between a bullet which simply goes down, from one which starts the same, then moves toward the player by a degree, and explodes on a timer. It's significantly more intense.
Sorry for the rant. Shmups are one of my favorite genres. If you need any consultation or examples, I'd be happy to lend a hand. :)
Also, there was crazy lag on the level 2 boss. Crashed my browser. I'm using Opera 11.62. Two other issues I noticed while playing through it: the black enemies and the level 2 boss are overly difficult to hit, because you get into a match of attrition where you're just mutually destroying each other's bullets (this is where bullet patterns come into play.) And hitboxes. They're too big.
Hi avgvst,
Thanks for trying out my game. I went ahead and upgraded my Opera to 11.62. Yes, it does lag after a while of playing, probably issues with Opera's garbage collector. Didn't crash for me though. Not sure what "black enemies" you are talking about. It could be an image failed to load, a refresh should fix that.
Your solution for touch input is pretty much what I've implemented. But the only problem seems to be on some mobile platforms there is a double tap zoom feature that gets in the way. I have not been able to disable that.
I'm no longer working on this game, I've got another project now. But I've open sourced it, so anyone who wants can go ahead and try to make it better.
Gaurav
HTML5 Canvas Old School RPG
Even tho, the e3 consortium warns, that the html5 support for the semsors orientation, accelleration and compass could be explemented (is that a word) or being dropped in future specs (due to privacy issues...:) .), you may want to consider to use them optipnally, if present and supported. Esp. Orientation can be used for steering.
That being said, you should provide choice and fallback controls for all devices, imho.
I just played it and want to add: great game, runs very smootly, is that a canvas? Anyway, on mobiles there is a significant diffrence: the device only knows where the "mouse" is while the "left mousebutton" is being pressed, that is actually your finger, touching and moving on the display. Slightly unconventional would be an approach, in which the player has to lift his finger for a quick instance, to fire, instead of pressing something. Them again you'd need to check whether he has a touchdisplay or a mouse.
I would definitely also offer support for the device orientation handler, it works very well to steer things.