so im doing some flash development (for iphone specifically right now), accelerometer ball is being controlled via the tip and turn of the phone. rolling it around the stage. im trying to limit it to the stage viewable area (320x480) so that you can't lose the ball off the screen, stopping it and rolling it along the edge. as is right now the ball quickly rolls off the screen never to be found again off in the ether
anyone smartypants enough to modify this below code to bound this to the stage area? i'm getting stuck
import flash.sensors.Accelerometer;
import flash.events.AccelerometerEvent;
var acc:Accelerometer = new Accelerometer();
acc.addEventListener(AccelerometerEvent.UPDATE, update);
var tx:int = 0;
var ty:int = 0;
function update(e:AccelerometerEvent):void
{
tx = e.accelerationX * 100;
ty = e.accelerationY * 100;
}
this.addEventListener(Event.ENTER_FRAME, loop);
function loop (e:Event):void
{
ball.x +=((ball.x + tx) - ball.x) * 0.3;
ball.y +=((ball.y - ty) - ball.y) * 0.3;
}
what the fuck do you use for code tags around here? bah
You could always click on the help link, dummy 
i didn't see a helplink? i see a link to markdown now that im looking at it. and they say wrap everything in `'s. doesn't seem to work?
Jesus, dude. It's like helping a retarded uncle, I had just edited your post to make it work and you screwed it up 
(quote me to see the source code for this post)
function fnord() {
console.log("23 skidoo!");
}
And for inline code the backticks work just fine.
fack that. i just stuck in linebreaks.
your code view markup is too complicated 
i had no idea you were in editing it. angry computer guy
Seriously? You can't figure out how to put three backticks on a line? I love ya, derry, but you're a tard 
(that said, when I start providing hosted forums I'm deffo going to have a wyswig editor)
<blink>
well now that's looking pretty. good work team.
in the meantime, i think i got my question answered on YH
ball.x += (((ball.x + tx) - ball.x) * 0.3) % stage.stageWidth;
if(ball.x > stage.stageWidth) ball.x = stage.stageWidth;
if(ball.x < 0) ball.x = 0;
ball.y += (((ball.y - ty) - ball.y) * 0.3) % stage.stageHeight;
if(ball.y > stage.stageHeight) ball.y = stage.stageHeight;
if(ball.y < 0) ball.y = 0;
Originally posted by Stinky
Seriously? You can't figure out how to put three backticks on a line? I love ya, derry, but you're a tard
(that said, when I start providing hosted forums I'm deffo going to have a wyswig editor)
i've been using forums for years, and i've never seen that convention. im not a bonehead, it's just not written out at all in the doc that you linked to. and i don't see anything labeled "help" on the twelvestone page here anywhere
http://daringfireball.net/projects/markdown/syntax#precode
that section shows nothing about 3 backticks. it might make sense to you since you put it all together, but average joe (who works on the internet every day for 12 years) it wasn't clear. i looked around
chalk it up not to a tard, but to it not being clear at all. im not trying to be difficult (quite the opposite), just trying to easily post some code and there was no easy way to do it. there's a case study on usability 
shaboink. found it. http://daringfireball.net/projects/markdown/syntax#code there is a link for "code blocks" on that page, which i assumed was for showing code, and for "code" that i missed because i thought i already was at it.
retarded is having to read a 30 page document to figure out how to post code to a forum
. why not just use bb tags or easier, html?
hey, let's all hit our heads against the wall a few times?
Originally posted by derrickito
hey, let's all hit our heads against the wall a few times?
I have to do that all day at work... I'll pass.
Also wavey
:beer: :sad:
Originally posted by derrickito
retarded is having to read a 30 page document to figure out how to post code to a forum
. why not just use bb tags or easier, html?
BBCode is fucking slow and brain dead, that's why 
That said, I am planning on putting in a better "formatting instructions" thing. One more like the one that github uses. Still, a web dev that doesn't know markdown is kinda funny.
Is someone trying to port pinball to air?
cause...
I don't think you can do that.
:markdown removed by barn:
Originally posted by persist
Is someone trying to port pinball to air?
cause...
I don't think you can do that.
:markdown removed by barn:
+1