Excal's Recent Forum Activity

  • Here's an updated version of the .capx that features a text overlay showing the enemy and player forces applied upon a collision.

    ImpulseCollision.capx

    I'm starting to wonder if the physics library is bugged. Sometimes the force seems to be applied and the objects 'bounce' off each other, other times literally nothing happens and another collision happens between the two because neither has moved.

  • You can also try to use photoshop's or gimp's "magic stick". It's a tool that allows you to make selections by the color (or a variety colors and shades, depending on how you set it up). It always depends on the picture. If it has a very good contrast to the background, this tool might work quite nicely!!!

    For sprites where the magic wand tool is able to accurately select your sprite, this is a better option.

    Magic Wand selects sprite

    New layer via Cut

    Delete the lower layer

    And voila, you have just the sprite, everything else is transparent.

  • Click the Project folder in the 'Projects' tab. There should be a property called 'Starting Layout'. You can set it there.

  • You load the image as a sprite, then zoom in with the sprite editor and edit the image 1 pixel at a time using the eraser tool to remove the 'white' and add transparency.

    A little time consuming but that's how I did it for the walking character in my maze.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Also, you have it the player ship figuring out the momentum with it's own velocity, not the velocity of the enemy ship. :)

    Isn't that correct though?

    delta v1 = (m1 - m2) / (m1 + m2) * v1

    delta v2 = 2m / (m1 + m2) * v1

    If we say that v1 = Player velocity and v2 = enemy velocity, then delta v1 = player momentum change and delta v2 = enemy momentum change, so it would be:

    Player apply impulse of [delta v1] at angle Player.angle + 180 at Image Point 0.

    Enemy apply impulse of [delta v2] at angle Enemy.angle + 180 at Image Point 0.

    <img src="http://i.imgur.com/dfVXRZA.png" border="0" />

    The impulse still is very strong, with some cases where the enemy ship teleports across the screen.

  • When I use impulse, the result of the collision (the two objects 'bouncing' off each other) is sudden. One second the collision happens, then suddenly the two objects are a considerable distance apart from each other. It doesn't look 'smooth' but looks more like teleportation.

    Here's my project with impulse instead of force - you'll see what I mean.

    ImpulseCollision.capx

  • So I've used the Apply Force at an Angle property in Physics for each object.

    For example:

    Player: Apply physics force (Player.Physics.Mass - EnemyCrescent.Physics.Mass)/(Player.Physics.Mass + EnemyCrescent.Physics.Mass) * Player.Physics.VelocityX at angle cos(Player.Angle) * (-1)

    I've done this for the Y direction, and then used the second equation for the Enemy object.

    However, I'm still not quite getting the effect I want.

    When the two objects collide, they appear to be stuck together. I've updated the live example above with my current version.

    Here's what my event sheet looks like for this part:

    <img src="http://i.imgur.com/T8UneT1.png" border="0" />

  • I'm trying to create a realistic collision between two moving objects, causing them both to bounce backward. I'm using it for my space game:

    Space Game

    Basically I'm trying to get the acceleration so I can apply a correct force to the collision.

  • How would one get the current acceleration of a moving object?

    I know that A = dv/dt, but I'm not sure how we would get dv. Can someone help me with this?

    EDIT: Here's my current line of thought.

    I have an object with a set acceleration of 120 and a max (capped) acceleration of 320.

    As long as the up arrow (causes player movement) is down, I would add 120 to the variable.

    As long as the up arrow is not down, I would decrease this variable by the built-in deceleration rate (hand-chosen amount, since I can't use physics friction coefficient without knowing what that deceleration rate actually is).

    As long as the down arrow is down (braking), I would decrease this variable by the braking deceleration amount.

    So really I would be tracking keypresses to track the (supposed) acceleration, and not actually getting the actual acceleration.

    Does this sound right? Is there a better method?

  • Here's an updated version of the project.

    The player is now correctly 'bouncing' off of the enemy upon collision, but the enemy remains in place. I'm not sure how to make the enemy 'bounce' (completing Newton's Law). Any help in this area would be appreciated.

    Here's a screenshot of the events where the collision is handled.

    <img src="http://i.imgur.com/AxpmsLU.png" border="0">

    CollisionNotWorking2.capx

  • No idea on the sprite and parallax, I'm probably just getting confused because I'm working on a space shooter that uses multiple moving backgrounds.

    There isn't one method that's better than the other in the case of sprite with wrap versus tiled background object. My claim was that he was doubling the size of the tiled background and repositioning it after it got off the screen, and I felt that it could be more optimized.

  • What do you mean by 'letterbox scale'?

    I noticed you're trying to make the background scroll by doubling the size of the background at program start and then having repositioned once it gets off the screen. This is a little inefficient in my opinion.

    Just make a layer for the background, load the background image as a sprite, and then set that sprite to wrap. Have the sprite move some number of pixels on every tick, set the parallax to the background layer to something like 100, 30 and that should do it (you may have to make a few tweaks).

Excal's avatar

Excal

Member since 9 Mar, 2013

Twitter
Excal has 1 followers

Connect with Excal

Trophy Case

  • 11-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

13/44
How to earn trophies