0 Favourites

Top-down fake 3d physics

  • Imagine you want to drop a load of coins on the ground in a top-down, 2d world using 2d physics. How would you do it?

    Attached is a capx showing several attempts I've made to bounce an object a set amount of times on an arbitrary Y coordinate.

    The advantage to setting Y coordinates as collision axis is that you can create 5 coins that randomize where this Y collision will be and each bounces in a unique place. If you tried to do this with invisible immovable physics objects, you would not get the desired FX.

    bouncingObject.capx

    Tips: try increasing and decreasing the bounceStrength instance variable of the green physics ball. The blue ball is just a graphic that is pinned. In a real game you'd probably make the physics object invisible.

  • Here is less complex way (and you wont need to use physics objects!): Bouncy Balls

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Well, ideally I want to avoid using collision objects in favor of randomly generated Y coordinates as the bouncing axis for an arbitrary # of items.

    However, I might be able to borrow the bullet idea if I decide to go the route of creating 3-4 invisible sprites at slightly randomized Y locations about the base of the enemy's sprite. Then I'd have to ensure that different items only bounce against specified sprites.

    Which method do you think has more performance overhead?

  • Your design has motivated me to try an alternative using the bullet behavior as described above and it seems to be working somewhat so far.

  • Alright, so if I spawn an "itemdrop" object that keeps track of 4 "bouncepad" objects every time a monster is killed, the game performance grinds to a halt after about 10 itemdrops are on the screen.

    The "bouncepad" object is basically just an invisible sprite object that the items are registered to bounce off of, so it makes it look like you have 3d physics. Each bouncepad receives a random Y position near the enemy's last x,y coord.

    There's got to be a way to optimize this.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
1,941 263,297
FlyingRam's avatar
FlyingRam
Unread hot topic
0 Favourites
[BEHAVIOR] Chipmunk Physics
673 82,509
nelostic's avatar
nelostic
Unread hot topic
0 Favourites
[Plugin] Three.js 3D canvas
134 12,727
Schoening's avatar
Schoening