PDA

View Full Version : Snake Game


dangerwildman
03-04-2010, 19:37
I've created a snake game that is functional using a computer with a keyboard, I was wondering if it would be possible for me to place buttons in place to take over control so that it would work on the S9? If you want i can post the .fla project for anyone to play around with and see if you can figure it out

Mikeo
03-04-2010, 19:43
Post the .fla file, but the game should work fine as it is right now because the volume, forward and back buttons act as arrow keys.

lane32x
03-05-2010, 03:01
Post the .fla file, but the game should work fine as it is right now because the volume, forward and back buttons act as arrow keys.

oh yeah. b/c reaching back and forth across play/pause button, and remembering which one is up/down/left/right would be completely easy [no]
lol.

Meanwhile....
I'd be ok with seeing an iPod-esque control for a game (on screen controls). Bring it on!

nightmare
03-05-2010, 03:41
Why not a virtual keypad on the screen itself ?? Having left,right,up,down arrows placed just as on the keyboard.

Franki
03-05-2010, 07:19
Tap upper part of the screen > go up
Tap left part of the screen > go left etc.

dangerwildman
03-05-2010, 16:40
Tap upper part of the screen > go up
Tap left part of the screen > go left etc.

Thats what i want to accomplish, i'll get the .fla file if anyone else wants to try, but heres the game now,( it works with the volume and track control buttons):SNAKE GAME (http://www.mediafire.com/?j1eomntid0n)

Mikeo
03-05-2010, 22:02
Added on screen controls for this (http://www.snakegame.net/phonesnake.htm) snake game.

Button locations
http://img198.imageshack.us/img198/6467/buttonlocation.png (http://img198.imageshack.us/i/buttonlocation.png/)

Download (http://www.mediafire.com/?jktdmmmgnz4)

tirim4
03-06-2010, 05:27
Thanks for the game Errisper and Wildman, but right now its a little hard to control. Maybe virtual buttons like this or something alike would be better:
EDIT: Maybe the buttons could go all the way into the center?

Franki
03-06-2010, 06:21
You mean something like this?
http://img689.imageshack.us/img689/9550/buttonlocationgoed.jpg (http://img689.imageshack.us/i/buttonlocationgoed.jpg/)

tirim4
03-06-2010, 09:06
Yes, but it would be even better if the buttons filled out the whole screen, right now Im constantly accidentally touching the area just outside the game.

Mikeo
03-06-2010, 11:05
V1 - Changed button locations and added buttons on the side.

http://www.mediafire.com/imgbnc.php/f88da21763caaa4c73714bb750085f9a2g.jpg (http://www.mediafire.com/imageview.php?quickkey=nq53lmio5ji&thumb=5)

Download (http://www.mediafire.com/?tzzizgjt1n2)


V2 - Changed button locations and resized to fit screen.

http://www.mediafire.com/imgbnc.php/c541edec54d305fc859a3d4460986fb02g.jpg (http://www.mediafire.com/imageview.php?quickkey=kmtemonf0zz&thumb=5)

Download (http://www.mediafire.com/?h3tckgzn4ym)

joejoe
03-06-2010, 14:25
V1 is better ! Thanks ! ;-)

tirim4
03-06-2010, 15:31
Im not sure which version I like the most, but a 100 thanks for uploading both versions, options are allways nice.

joejoe
03-07-2010, 06:14
I'd recommend a third solution based on v2: Make the controls relative to the current position of the snake.

Vulture
03-07-2010, 08:21
I think V2 is the best one.

I've created a snake game that is functional using a computer with a keyboard, I was wondering if it would be possible for me to place buttons in place to take over control so that it would work on the S9? If you want i can post the .fla project for anyone to play around with and see if you can figure it out

Is Neave.com your website ?

Ilmadic
03-07-2010, 11:26
i think v1 is the better one!

bashibash
03-07-2010, 11:44
i think joejoe has a really good idea, i got snake on my lg arena phone, and the controls are relative to the current position of the snake and it works perfect!

Nippur
03-08-2010, 09:24
I have an advice if you want to improve the game. It seems you use a random position of new appearing dot. Sometimes, the dot appears under the snake body. It would be nice if you check the new dot position to prevent this.

And if you want to improve it even more, you can add a pause button :)

Anyway, I like it a lot, thanks for sharing.

Vulture
03-08-2010, 16:33
I have an advice if you want to improve the game. It seems you use a random position of new appearing dot. Sometimes, the dot appears under the snake body. It would be nice if you check the new dot position to prevent this.

And if you want to improve it even more, you can add a pause button :)

Anyway, I like it a lot, thanks for sharing.
Was thinking about this as well...

Perhaps you could make a snake g-sensor game =D

Mikeo
03-08-2010, 16:58
X.01 released.


Changelog

Added pause, press FF to pause and unpause.
Download (http://www.mediafire.com/?sharekey=ef1505dc62c0b0faab1eab3e9fa335ca3b20fafd 89b58b68)



I'd recommend a third solution based on v2: Make the controls relative to the current position of the snake.

The current control scheme was a simple matter of creating a few buttons and copy pasting a few lines of code, not sure how to implement this.

It seems you use a random position of new appearing dot. Sometimes, the dot appears under the snake body. It would be nice if you check the new dot position to prevent this.

I am using setproperty to determine where the food is going to spawn, don't know how to make it avoid the snake.

surgency
03-08-2010, 22:31
If something like joejoe's idea were to be implemented, i suggest the following :

joejoe
03-09-2010, 00:57
If something like joejoe's idea were to be implemented, i suggest the following :

The disadvantage of this is that half the space is unused, as you can only move along one axis.

If(Snake moves along y-axis, which means up or down)
{
You can only move left and right
}
If(Snake moves along x-axis, which means left or right)
{
You can only move up and down
}

surgency
03-09-2010, 04:36
Hmm... I see.
Damn. i almost finished programming this though..
anyways, i dont see how your idea would work anywyas. Would you tap the lines? because if you tap the quadrants...? it cant go diagonally.

joejoe
03-09-2010, 07:05
Hmm... I see.
Damn. i almost finished programming this though..
anyways, i dont see how your idea would work anywyas. Would you tap the lines? because if you tap the quadrants...? it cant go diagonally.

You can never move 'transversely' in snake lol

Options are always Up,Down, Left, Right

For instance, if the snake is moving along the y-axis, then movements possible are: left or right. That's why I suggested that tapping on the space to the right of the snake makes it move to the right, and then tapping on the space to the left of the snake makes it to move to the left.

surgency
03-09-2010, 20:47
I see.
I think ill program both and see which is more natural to use.

joejoe
03-10-2010, 07:07
This article might be interesting for you:
http://www.2souldesign.net/2010/03/how-to-make-gsensor-games-tutorial/#more-385

surgency
03-10-2010, 10:04
Yeah, ive seen it.
But i dont think snake should be g sensor controlled.

pallokallo
03-10-2010, 10:26
lol,d
"One of the reason Cowon’s s9 was a huge hit was its use of an accelerometer"

Yeah thats the reason why I bought it

lane32x
03-10-2010, 13:28
lol,d
"One of the reason Cowon’s s9 was a huge hit was its use of an accelerometer"

Yeah thats the reason why I bought it

<sarcasm> ??

hyva
03-10-2010, 15:54
<sarcasm> ??

What do you think? [cool]

surgency
03-11-2010, 03:26
OH, crap guys im sorry.
i forgot to post the link.
My bad.

Instructions:
during gameplay, imagine a line in every 45 degree increment. like this:
http://www.iaudiophile.net/forums/attachment.php?attachmentid=5321&d=1268109075
Its relative to your snake.
The buttons on the side are difficulty. Important: THE LOWER THE NUMBER, THE SLOWER THE SNAKE GOES.

Bugs:
Somehow it fails and is allowed to move one square to the right of the border. wierd.
Snake can go back on itself
Report more?

Next Up:
What joejoe suggested, another type of layout.
I will comment the code so others can figure out what im doing (as a basic explanation, i figure out what quadrant the new touch is, then i compare the x value to the y value to find out if its above or below the 45 degree line).
High scores, and other cool features. Or, another dev can adopt my code into thier snake game, and add these cool features on their own (<== good idea).

In the .zip, there is the .fla, and the .swf.
If you dont know what to do with those.... unacceptable.
http://www.mediafire.com/?rwz1nzklymg


Most of the code is taken from:
http://www.flashperfection.com/tutorials/Build-a-Classic-Snake-Game-in-ActionScript-2.0-41411.html
what i did is add touch functionality, variable difficulty, made it s9 sscreen sized, changed graphics a bit, and i think thats it.

tirim4
03-11-2010, 03:34
This is a great thread for inspiration on how to control a game if one is thinking of coding games for the S9! We have pretty much covered all possible ways (even a link to the G-sensor guide). Thanks Dangerwildman, Surgency and Errisper!

surgency
03-11-2010, 21:43
ive made a new version with highscores:
http://www.mediafire.com/?wnzjmgowtt0
Should i start a new thread?

joejoe
03-14-2010, 13:51
Looking forward to the next version.

surgency
03-14-2010, 15:37
I've already made your version of relative touch controls, but theres a bug in another part of the game i need to fix first.

joejoe
03-14-2010, 16:08
You might have added the relative controls, but the core idea of snake is actually the limited - thus super easy - control-option.
Your snake can always move left, right, up and down. Those additional options make it too easy.

In "G-Snake" the limited movement-options were implemented, as I suggested earlier.


If(Snake moves along y-axis, which means up or down)
{
You can only move left and right
}
If(Snake moves along x-axis, which means left or right)
{
You can only move up and down
}


But then again...maybe you're trying to make something different...

surgency
03-14-2010, 16:10
No no, ive made it like that, except that:
1. Its relative to snake's position.
2. When its going up or down, you can only press to the left or right of it, thus eliminating the extra directions. same for left - right.

I just haven't released this yet.