Flash
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Flash
i love the smell of code in the morning!
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: Flash
Using actionscript and php, how would I go about taking the player, saving their current location when they log out, so that way when they log back in, they are in that spot they were last at?
Right now all it does is control the ship. But when you log out, then back in, the ship is back at the starting point when you first ran it.
Right now all it does is control the ship. But when you log out, then back in, the ship is back at the starting point when you first ran it.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Flash
Are you using a database? I would think that you could save their last location into the database, and add the replacement of the player at their last location to the start-up when the player logins in. When the start-up code runs, you could also have a condition that if no location is found for the player in the DB that is assumes the character is new and begins them in the default position. If you are not using a database, you would need to have about the same setup with some other kind of file or variable saving location.
The indelible lord of tl;dr
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: Flash
Im using MySql and php with it. So, yeah there is a database, but I just dont know how to set it up and make it work. Right now Im also working on trying to correct the error im getting with the code neronix gave me. The code that Agent fixed for me, is what I'm currently using with the flash file, works great until I can get the other working.
Re: Flash
not read the whole thread... so dnno wht ya lookin for or ya problems.. I dont rly know n e thin bout flash...
but head over toooooooo developphp.com they have quite a few flash/php tutorials. dunno if u can find summert in there tht mite help ya
LUBS xx
but head over toooooooo developphp.com they have quite a few flash/php tutorials. dunno if u can find summert in there tht mite help ya
LUBS xx
New Site Coming Soon! Stay tuned 
Re: Flash
Like I said before, this is a tough job to pull off. I recommend sitting down with some paper and pen and mapping out the structure/functioning of the game in a layout map. So how server communicates with client / etc.SpiritWebb wrote:Using actionscript and php, how would I go about taking the player, saving their current location when they log out, so that way when they log back in, they are in that spot they were last at?
Right now all it does is control the ship. But when you log out, then back in, the ship is back at the starting point when you first ran it.
Anyway, currently I assume you just have your 'flash game' embedded in the html file following the login. This of course will not save the last known position by itself. SO you must have as i stated before a .php script that will communicate with your flash file (exchange variables).
So you could try to do something like this (I am just making this up on the spot, you will have to modify it to suit your needs):
You could get your positions last known position in a few ways i guess - but a smart - less process active way could be that on pressing the logout or save button / whatever - the engine executes a command to get the ships position and translate that over to a php variable which THEN externally saves out to a database. Then the same process back - when the play logs in the flash file searches for the locally stored player variable .php file and automatically asks for the x and y pos of the ship (when last saved) then translates that over. So something like this could be used-
getXPos = this._x;
getYPos = this._y;
where then for example -
$playerXPos = getXPos;
$playerYPos = getYPos;
and to set the ships position back on login -
this._x = $playerXPos; // or getXPos
this._y = $playerYPos; // or getYPos
See how you go with that...
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: Flash
neronix:
Any ideas on how i can fix this?SpiritWebb wrote:lol...its cool.
I got it all to show, but now my map is all over the place...it places the map down on the far left, not centered...
what size should the map be? The map is centered to the ship, on its right border.
EDIT: When I press the down key and left or right, it quits moving...only up seems to work. I aim down, the map scrolls right. Aim right, map goes up, aim up, map goes left, aim left map goes down.
Re: Flash
If whats happened is what i think has then first when you make the map make sure its at 2000x2000, thats what my ones set to. The second problem i think would be the direction your ship is facing when you made the symbol, make sure it is facing towards the left and that should make it move properly, the problem with reversing is that my one didnt have that so Il go see if i can get it to do that for you just nowSpiritWebb wrote:neronix:
Any ideas on how i can fix this?SpiritWebb wrote:lol...its cool.
I got it all to show, but now my map is all over the place...it places the map down on the far left, not centered...
what size should the map be? The map is centered to the ship, on its right border.
EDIT: When I press the down key and left or right, it quits moving...only up seems to work. I aim down, the map scrolls right. Aim right, map goes up, aim up, map goes left, aim left map goes down.
This isnt just a gimp mask...This is an S&M gimp mask...
Re: Flash
right, for the code for reversing you just have to change one bit:
this
to
the speed for going backwards is slightly slower than the speed of going forward but you can speed it up by making the number in bold lower (like -2.5), hope thats the answer you were looking for 
EDIT the number in bold tags actually, since they dont work within the code tags
this
Code: Select all
// brake
if (Key.isDown(Key.DOWN)) {
speed *= 0.75;
}Code: Select all
// brake
if (Key.isDown(Key.DOWN) && speed<maxspeed) {
speed -= [b]-1.5[/b];
}EDIT the number in bold tags actually, since they dont work within the code tags
This isnt just a gimp mask...This is an S&M gimp mask...

