Flash :: Preventing Box2d Player From Pressing Against Walls In Midair

Nov 20, 2011

I have setup a box2d world with a keyboard controlled player. The player can walk and jump. How do I prevent the player from "sticking" to walls while jumping and pressing the directional key towards an object?

View 3 Replies


Similar Posts:


IDE :: Preventing Flash Player Caching

Sep 8, 2009

edit: Resolved; my ActionScript function for parsing the mySQL results didn't correctly interpret a recently modified column, and the corrupted new output happened to be identical to the old output.

I have created an application that accesses a PHP/mySQL database, but it caches old information.

I used the workaround from Adobe's website, where I append '+ new Date().getTime()' to the URLRequest String, but the application continues to use the old data.

When I trace the URLRequest String and C&P it into a browser window, however, I receive the correct data.

View 2 Replies

ActionScript 2.0 :: Player Cannot Pass Through Walls Using A HitTest

Dec 22, 2011

I have set up a player (movie script) with basic movement, and some walls which the player cannot pass through (using a hitTest). But whenever the player moves into one of the walls in the X direction, the player skips through the wall and halfway up the stage.

View 9 Replies

Flash :: Use FBML To Embed A Custom Video Player / Video On Facebook Walls?

Oct 28, 2010

I'm trying to get a video (flv) or an swf video player to work on Facebook walls, however no matter what I do - facebook posts the raw fbml and ignores the code.

<fb:swf
swfsrc='http://www.domain.com/flv_player/Main.swf'
imgsrc='http://www.domain.com/large1.jpg'

[Code]......

View 3 Replies

Actionscript 3 :: Programming Multiple Walls In Flash CS5?

Apr 8, 2012

I am trying to program a Flash Game that utilizes all four directions to move the character. (i.e. Pressing up moves the character north, down - south, etc.) The character in the game does not actually move, but the background moves to simulate movement. I need to figure out how to go about programming the walls, though. I have code that recognizes collision, but what is the best way to do it? This is my code:

stage.addEventListener(Event.ENTER_FRAME,handleCollision);
function handleCollision( e:Event ):void{
if(hero.hitTestObject(wall))
{

[Code].....

View 2 Replies

Flash :: Bouncing A Ball Off 4 Walls Of A Stage

Jan 5, 2010

When I bounce a ball off the walls of the stage using the following technique.[code]Not only is the ball jumpy and skippy. but after so often it begins to go either in a vertal motion y = 5; x = 0; or a horzontal motion x = 5, y = 0. And stays that way. Why is it that the first method works fine but the other method works terrible. Could it be because the Math.cos and Math.sin returns very large decimals.I really prefer to use the second method.

View 5 Replies

AS3 :: Flash - Stop Character From Moving Through Walls?

Oct 9, 2011

I want to stop the movieclips movement when it hits a wall (another movieclip). The example below works, but after the collision the movieclip 'blocks' all movement to the left...

For now the example with the leftArrow key;

variables to check the key, if it's hitting the walls and if it's moving or not:

var leftArrow:Boolean;
var speed:int = 10;
var hitting:Boolean;

[Code]....

View 2 Replies

Flash - Paddle Movement Using Box2D?

Jan 3, 2011

I'm making a game like Arkanoid and to move the ship with mouse, I'm using the following code :

var mousex:int = costume.stage.mouseX;
if (mousex < paddleWidth/2)
mousex = paddleWidth/2;
else if (mousex > PhysiVals.STAGE_WIDTH - paddleWidth/2)

[code]....

Everything's going fine there! The paddle is moving the way it should! The problem is I want a little inclination towards the direction its moving and when it stops moving the angle of inclination should become zero.

View 1 Replies

ActionScript 3.0 :: Flash Box2D & 2D Shadows

Jul 24, 2011

I'm working on a AS3 Game Engine at the moment utilizing Box2D (2.1a) and 2D shadows. I have Box2D down but I've yet to find a way of drawing 2D shadows efficiently.I was following this tutorial only to be disappointed by the speed at which it rendered the Box2D shapes and the shadows.I was getting the vertices of the objects via this function:[code]And using it to draw the shadows via the AS3 graphics api.Can anyone recommend me a better more efficient way of programming 2D shadows?

View 2 Replies

Flash :: Survivor Game (ennemies Going Through Walls, HitTest And Flashlight)?

Jun 5, 2011

I posted a bit earlier about some problems I had with a game I'm trying to do.[URL].. My first and main problem is that the ennemies are going through the walls. I can do a hiTest like with the player so that the collision is detected, but I don't know how to make the ennemy change direction. I thought it would be quite simpler if the ennemies could not move simultaneously on the x and y axis, but don't know how to do it. (then they would only need to make a 90 degrees turn)

Second problem is the hitTest for detecting collisions with the ennemies. It seems like I'm not able to do it. There is the part which I thought would be good at the end of the script in commentary. Third problem, which is the least important in my eyes is that we see the ennemies even if the "flashlight" is not aimed towards them.

[Code]...

View 1 Replies

Flash :: Professional :: Create A Simple Paint Visualizer - Display Walls

Apr 4, 2011

i'm trying to create a simple paint visualizer in flash. need to display two walls for example and a vertical color palette for the user to choose from. an example would be the following link [URL] (it's very advanced compared to what i need but i couldnt' find a simpler one on the web).

View 3 Replies

Flash :: Change Center Of Rotation Box2d?

Feb 13, 2011

I have a b2PolygonShape body and apply a force to it.

_recbody->ApplyForce( b2Vec2(6.0, -6.0), _recbody->GetWorldCenter() );

I want to change the centre of rotation of the body to be more in the front of the body. So that applyForce and also collisions make the body not turn in the centre but more in the front.

View 2 Replies

Flash - Drawing Custom Polygons In Box2D?

Apr 14, 2011

I'm making a Flash game, and I've encountered a really weird problem while trying to draw a polygonal shape in Box2D.

Here's the code I use:

var fixtureDefs:Array = new Array();
...
var fDef:b2FixtureDef = new b2FixtureDef();
fDef.density = 0;

[code]....

Where vertexArray is a valid array containing 4 b2Vec2 vertices, making up a convex shape.The problem is, when I test, collisions don't work right for that body. Most other objects -enemies, user-controlled characters - pass straight through, as if the body isn't there at all. Some raycasts pass through as well.

Infuriatingly enough, one kind of bodies I have (a custom enemy) somehow does detect the body and collides with it. The raycasts that particular kind of enemy attempts do work - when your character hides behind the polygon, it's like they can't see him.The other weird thing: when I try the same code, only go for SetAsBox instead of SetAsArray, it works exactly as it should.I'm using a custom ContactListener class, but I haven't done any contact filtering (unless it's possible to do that without realising).I'm using the Flash 9 version of Box2D 2.1a.

View 2 Replies

Rotating And Throwing Objects Using Flash And Box2D 2.1a?

Jul 26, 2011

i'm using flash with box2D 2.1a. i'm rotating ball hanging on the string. The path which the rotating ball trace is ellipse. When releasing the rotating ball from the string i want the ball to fly with the obtained direction, velocity and strength. As you can see in the pictures.[URL]..I've tried to do it with setPosition (method of b2Body) and with various joints. But I haven't got the needed results.

View 2 Replies

Flash - How To Climb Up Or Stick To Other Objects In Box2D

Jan 12, 2012

I know that trying to model character movement in Box2D is always hard/impossible, but I'm trying to see if there's any way to make an user-controlled object that cleanly slides against other objects, going up or down, that makes it look like the character is climbing/walking up or a down. The character could be modelled as a circle if that simplifies matters, but I don't see how I could get this effect using just a circle with a joint motor.

There's a "wheel joint" in the C++ version of Box2d, which I suppose I could port to Flash, but I don't know if that would give the correct effect either. Another idea I had was to have the character do little jumps, based on the normal of the object that it is touching. But I suspect that at corners, or at contacts with multiple objects, this will give weird results.

View 1 Replies

Flash :: Box2d Body Shape Modification?

Jan 13, 2012

Is it possible to modify a shape within a body after assigning it, for example I have a box shape for my game hero body, and when I press the down arrow I want my hero to crouch witch means that I need the body shape to be resized.

I've already searched in google but it appears that the topic of modyfing shapes is not so popular. If it's impossible maybe you know a better way of doing this.

View 1 Replies

Flash :: Box2d B2BodyDef Have A Massdata Property In Cocos2D?

Mar 9, 2012

I want to know if box2d b2BodyDef has a massdata property or if it can be accessed in some way. I am not sure whether this can be done in Cocos2D but I have seen it in the flash code I am trying to re-implement in cocos2d.Here is the the code that brought about the question.

[Code]...

View 1 Replies

Flash - Create A Platform Body That Spins On It's Center In Box2D?

Feb 24, 2011

I'm trying to create spinning shapes floating in space. There is still gravity in the environment, however it should not affect these platform objects because they are static (right?). How can I apply a constant angularVelocity to it though? It doesn't seem to apply when I assign it a value, probably due because it's static.

The simplest example would be a spinning gear, an automated teeter-totter (not influenced by external forces). All I'm trying to make is a spinning rectangle that could interfere with a ball controlled by the user.Do I need to use Joints to pin it in place? How can I specify the details of not being influenced by the dynamic objects?

View 1 Replies

Flash :: Box2d, Detect Collision Between Static And Dynamic Bodies?

Apr 12, 2011

i am listening contact between dynamic bodies. But cannot listen contact between dynamic and static bodies .

I can handle collision detection on my b2contactListener class with this metod.

public override function BeginContact(contact:b2Contact):void {
// getting the fixtures that collided
var fixtureA:b2Fixture=contact.GetFixtureA();

[Code].....

View 1 Replies

Actionscript 3 :: Box2D In Flash Runs Quicker When Drawing Debug Data Than Not?

Jan 24, 2010

I've created a small game with Box2d for AS3 - I have sprites attached to the stage that take their position from the underlying Box2d world. These sprites are mostly PNGs.When the game runs with DrawDebugData() bening called every update, it runs nice and smoothly. However when I comment this out, it runs choppily. In both cases all my sprites are being rendered. So it seems that it's running faster when it's drawing the debug data additionaly (i.e. my sprites are on the screen in both cases!)What's going on? Does drawing the debug data flick some sort of 'render quick' switch? If so, what's the switch!? I can't see it in the Box2D code.

function Update(e){
m_world.Step(m_timeStep, m_velocityIterations, m_positionIterations);
// draw debug?[code]...

Interestingly, If i set the debug draw scale to something different to my world scale, it slows down to 19fps. So there's something happening when it draws the boxes under my sprites causing it to run quicker..

View 2 Replies

Flash :: Movie-style Shotgun Blast (sticky Collision) With Box2D?

Jan 29, 2011

I'm making a Flash game where the player throws balls of mud at objects in the sky. I'm using Box2D to model the physics. I don't want the ball to bounce off of objects (apply a normal force); instead I want it to impart its momentum on the object it is striking (like a movie-style shotgun blast).

View 1 Replies

Actionscript 3 :: Flash + Box2d Pool Game Breaks Online Because Shots Are Not Transmitted Precisely?

Dec 25, 2010

I'm, working on this pool game: [URL] open it in TWO browser windows you will see that the 2 player modus starts. When you make a shot, every shot gets copied to the other player. Unfortunately it is not precise enough. The player makes the shot with this code:

[Code]..

View 2 Replies

Flash :: TLF Text Is Preventing OnMouseOver Event?

Jul 8, 2011

Basically I have some TLF text as a symbol, it's read only, the font is embedded and I set mouseEnabled to false. It's sitting as a graphic, on top of a button. When I mouse over the text, or the area where the text would be, it prevents the button from receiving the on mouse over event. Using classic, dynamic text, this route normally works just fine. Any ideas what could be causing the problem?

View 1 Replies

Professional :: Preventing Remote Url File Reads In Flash?

Oct 29, 2010

We have a Flash application provided by a vendor. It reads its parameters from an xml file on our web server's file system. However, it can also be spoofed to read its parameters from an xml file sitting on another domain's web server. At first we thought crossdomain.xml might be able to fix this, but we've researched it and understand the purpose of crossdomain.xml. It won't solve this issue.Are there any ways of enforcing that a Flash application reads its input file only from the same server where the Flash application was served? Or is the recommendation just to initialize variables within the Flash app, not relying on an external file.

View 3 Replies

Flash :: Preventing A Swf From Invoking ExternalInterface Calls Without Recompiling It?

Apr 16, 2011

I'm working with a third party swf that I cannot change and am charged with making it work in a local environment, loaded within a container application I have built. The SWF was published for accessing the network sandbox, so whenever it invokes the ExternalInterface in a local html container, it throws a security sandbox error and kills execution. The ExternalInterface calls are all non-critical (logging) so if I can block them somehow, then I won't have a problem any more.

View 3 Replies

ActionScript 3.0 :: Flash Preventing TextField From Getting Mouse Attention?

May 21, 2010

I want to have a Sprite with an child TextField, but without the textfield triggering or preventing any mouseover events from its parent.

An example would be a world map where each country has a label with its name. For smaller countries, the label would naturally exceed the country's borders. However, the label should not get in the way of mousing over whatever is beneath it (i.e. neighbouring countries).

View 2 Replies

Actionscript :: Flash - Preventing Navigation Via Clicking Anchor Link?

Jun 22, 2010

I am creating a textbutton using actionscript. the code is given below.

public function createTextButton(parentId){
var mytext:TextField = new TextField();
mytext.x = 478;

[Code]....

Now i want the click event of this button to be handled in my event handler function only. It should not navigate away to the 'href' source given upon clicking. How can i achieve that.

View 1 Replies

.htaccess - Flash Menu Preventing Site Navigation When Accessing Url With Out Www

Feb 11, 2011

Client has a flash navigation menu on his website. When the site is accessed via [URL] the hardcoded links in the flash nav load pages properly. When accessing the website via the [url] the site navigation links can not load the proper pages and instead just redirect the user to the root domain.

I assume this can be fixed with a change to the .htaccess but I do not know how flash handles these links.

.htaccess:
Options +FollowSymLinks
RewriteEngine on

[Code].....

View 1 Replies

Flash - Flex 3: Preventing Keyboard Events From Reaching A Sprite?

Feb 9, 2012

I'm working on a Flex 3 app, implemented in Actionscript 3 and MXML, that includes an embedded video player, which is essentially a black box--I load it as a SWF from another site on demand, and I don't have access to its source code. It does, however, inherit from Sprite.The problem is that, when focus is on the Flash app, the video player is somehow receiving and processing keyboard events, even when the player itself isn't in focus.So when users are typing text elsewhere in the GUI, if they hit the space bar, the video pauses.

I've tried intercepting key events in the Sprite's parent, and setting tabEnabled = false, tabChildren = false, and buttonMode = false on the Sprite, but nothing seems to work. It's as if the Sprite is getting keystrokes through an alternate Event path.how I can prevent the player from receiving keyboard events or input events entirely? It's fine with me if no input events reach the player, since I've implemented my own,separate video controls.

View 1 Replies

ActionScript 2.0 :: Bouncing Off Walls?

Dec 14, 2003

then you will see that when you hit the walls or boundrys you "bounce" off them. I have accomplished stopping movement when hittest occurs but how shall I get the car to "bounce" off the walls. It would be great if you could supply the full code as I am not a great coder.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved