File :[ball test.swf] - (2 KB)
[_] [G] beginner at flash coding, need help Anonymous 05/13/09(Wed)12:05 No.978595
Just trying to get the basics of a game going here. I'm really a beginner at flash so any help
appreciated
I've got the ball moving around but the collision isn't working correctly as you can tell if you
play around with it for a bit
What do I do?
>> [_] script on ball Anonymous 05/13/09(Wed)12:06 No.978597
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x=_x-10;
}
if (Key.isDown(Key.UP)) {
_y=_y-10;
}
if (Key.isDown(Key.RIGHT)) {
_x=_x+10;
}
if (Key.isDown(Key.DOWN)) {
_y=_y+10;
}
if (hitTest(this._parent.rBlock)==true) {
_x=_x-10;
}
if (hitTest(this._parent.lBlock)==true) {
_x=_x+10;
}
if (hitTest(this._parent.bBlock)==true) {
_y=_y-10;
}
if (hitTest(this._parent.tBlock)==true) {
_y=_y+10;
}
if (hitTest(this._parent.cBlock)==true) {
_x=_x-10;
}
if (hitTest(this._parent.cBlock)==true) {
_x=_x+10;
}
if (hitTest(this._parent.cBlock)==true) {
_y=_y-10;
}
if (hitTest(this._parent.cBlock)==true) {
_y=_y+10;
}
}
>> [_] Anonymous 05/13/09(Wed)12:18 No.978601
Pretty good stuff, bro. Though, does Flash have something like a SWITCH or CASE statement? If it
does, it might make for tidier programming.
>> [_] Friendsofsandwiches 05/13/09(Wed)12:55 No.978613
That reminds me, anyone seen anything more on the Tornado flash guy?
>> [_] tinycat !!NqU6wU7JQ+v 05/13/09(Wed)13:06 No.978617
>'ve got the ball moving around but the collision isn't working correctly as you can tell if you
play around with it for a bit
call it a feature and design a game around it.
>> [_] Anonymous 05/13/09(Wed)13:16 No.978625
fail, this is square collision detection, not circle
>> [_] Anonymous 05/13/09(Wed)17:02 No.978733
Your ball move correctly, however since I assume the center black block should be inaccessible,
there's problems: the right and bottom edge of the block can be passed through, and goes right
through the block, only entry into the block via the left or top edges is prevented.