How do you bounce collision detection with ActionScript 3.0? (With video)

Well, firstly, I am surprised that actioncript 3.0 does not have pixel-based collision detection.

In any case, I use the conflict library found here (I am ready to choose another library, if necessary)

I recorded a video to better show what I'm trying to do, in short, I am scrolling (e.g. mario) and I want my land (floor) to act just like land ... when a user walks on the ground, lol

At first I thought about making a bounce effect, for example, "if the user is at level X below the surface of the earth, and then pushes him." It seems wonderful, but the only way I found that I can do this is to make my user just keep jumping when he touches the ground (not in the video).

So does anyone know how to do this so that when my user walks up and he goes up the hill on the ground, he will also make the char users up too?

+3
source share
2 answers

reddit.com ActionScript 3, .

, , . - , ?

( ) , . ( ), . , , .

// How many pixels each index of the heightMap contains.
// You'll probably want to use the same value as the distance
// your character moves when the move left/right key is pressed.
const SECTION_SIZE:int = 10; 

// Fill this as a huge array with all the heights and
// the size of this will be (mapHorizontalLengthInPixels / SECTION_SIZE).
// Each element will be the distance from the top of the screen to 
// place the character so it looks like it is standing on the ground.
var heightMap:Array = [ /* ... */ ];

// TODO: you might want to Tween to this value so it doesn't look chunky
character.y = heightMap[character.x / SECTION_SIZE];

, int, heightMap BitmapData. , BitmapData getPixel32() . , ( png), SWF.

, , , , , , ... 2d. , APE, Box2dAS3, Fisix FOAM . , , . , , , !

+4

, , . , (, 1 , , ), . , , . , - , , , > 10 .

+2

Source: https://habr.com/ru/post/1714684/