terence's Forum Posts

  • In my top down shooter I have different enemies made up of several sprites each which are pinned to the main enemy sprite. When an enemy collides with the player or player projectiles I want some of the sprites of the enemy to disappear, some to stop moving and others to change frames/animation based on the nature of the collision or overlap.

    At this stage I don't want to use families and containers don't seem to be suitable. I'm trying to pick each of the sprites for a given enemy using "pick instance by comparison" and instance variables, but I'm unable to achieve the desired result, probably because my system pick events are not correct.

    The .capx linked below contains a simplified example. Any suggestions appreciated.

    copy.com/JdsiG1uaT4e1

  • In some cases, I'd like the bullet to carry on. The workaround I came up with was to have the object being hit spawn a new bullet with the same angle/speed, and this seems to work OK.

    The bigger issue I have with custom movement is that it cuts the frame rate from 60 to 20-30 frames at certain times. My layouts are fairly large (10000 square) and I can have upto 15-20 bullets on screen at once. For accuracy, I need to have at least 10 pixels per step.

    Other than destroying the bullets when they are outside the layout or hit other objects, is there anything else I can do to improve performance? If not I may need to rethink using custom movement.

  • Thanks, both suggestions work but will go with EncryptedCow's approach as it's easier to implement.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have a bullet I want to bounce off some solid objects but pass through others. For those objects where I don't want the bullet to bounce, I have tried disabling the solid (and collisions) on collision. But the bullet still bounces off the object once if I have the "bounce off solids" option set to yes.

    I have also tried adding two bullet behaviors (on my bullet) using the method described in the post linked below (one with bounce, one without), and switching between the behaviors at the time of collision but I still find that the bullet bounces (once) off the objects I want the bullet to pass through.

    scirra.com/forum/turn-off-bounce-off-solids-via-Event_topic53021_page1.html

  • Thanks for all the replies. Will test out each method to determine what works best for my project.

    Ramones, the custom movement bullet example you provided seems to work well, but I have one issue. On collision I have functions being called in actions depending on the object the bullets are colliding with.

    Now that I'm using the is overlapping event (instead of on collision), I find that my functions are being called multiple times instead of just once as required, I guess because of the increased accuracy.

    The "stop custom movement stepping" is my first action on overlap (as per your example) before calling my function. Is there any way to execute my functions just once when the is overlapping condition is true - for many ticks?

  • MACPK: I'm avoiding Physics in my project, but as a test I enabled physics collisions on the objects and set the physics bullet property to yes on the projectile, and it didn't seem to make any difference. Is there any other non-framerate dependent/non-physics method of detecting collisions for small fast moving objects (with a speed of 10000+)?

    Colludium: I think I understand the method you're describing. An example would be helpful.

  • I have tried the custom movement behavior on my projectiles to improve collision accuracy, but I'm facing 2 issues.

    1. The projectile is not firing from player angle

    2. Even with stepping mode set to 1 pixel per step my collisions are not detected

    Capx link: copy.com/euCkQrnoHUPH

  • I'm trying to implement the cinematic zoom defined in this tutorial within functions rather than groups:

    scirra.com/tutorials/254/cinematic-zoom

    The reason for this is that I plan to pass in parameters to speed up/slow down the zoom based on the values of certain instance variables.

    The problem is on turning this into a function, the code executes only once so zooms in/out partially on a key press rather than fully. Tried placing a the zoom value check in a while condition but it still only seems to execute once.

    Any suggestions or alternative approaches appreciated.

  • That makes sense, but adding this to my function that runs every tick results in no trails being produced. Any suggestions on the linked capx appreciated.

    app.box.com/s/08qkgm81kfwzd3oh3zya

    The character will only be moving in straight lines during the animation (whilst a temporary bullet) so this is fine.

  • Thanks for the suggestion. Almost have it working. In the capx linked below, the player triggers the trail when colliding with the "mud" sprite above a certain speed. The trail is smoothly revealed for Mud.UID=0. But for the other Mud sprite instances, the whole trail is fully revealed immediately on collision. Not sure why this is happening.

    app.box.com/s/skoha7qd3i7absayc3h8

  • In my top down game, on performing a certain animation my player sprite (blue circle) slides across the screen 1000 pixels at player.angle.

    I would like the (brown) trail sprite (frame) which is 1000 pixels in length to be revealed as the player moves during the animation.

    I can pin the trail sprite to the player sprite and have an animation with a large number of frames but it isn't smooth. I'm sure there is a more efficient way of "unmasking" the single trail sprite frame.

    Any suggestions appreciated.

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

  • That seems to work fine, thanks.

    Is there any way to get the enemy to slow to a stop rather than immediately stop? Have tried setting gravity to a negative value before the timer action but this doesn't seem to work.

  • Have tried this out but the movement doesn't seem to be right. I'm aiming for "soccer ball" type movement when the enemy is kicked by the player.

    Have created an example: copy.com/BlfuSTiwuoqy

  • In my top down shooter when my player sprite collides with my enemy sprite, I want the enemy sprite to smoothly move/slide 500 pixels away from my player sprite (relative to the enemy's current position). The speed of movement would depend on the enemy type.

    Looking at similar posts I think I need to use lerp but not sure how this would incorporate both x and y movement and the angle of movement. Would it require separate actions?

    Any suggestions appreciated.

  • Making the canvas (and collision polygon) length 100+ pixels works but sacrifices a little accuracy in the collision.

    The custom movement option sounds like the ideal solution, will do some research into this.

    Thanks both for the quick response.