Sushin's Forum Posts

  • I guess I can do that if I upload an image of the gun with the same pivot point as the upper body. I was trying to avoid that and just attach the gun to the hand, because the upper body rotates.

  • So in the picture to the left, the character is moving left, and the gun pinned to their hands lags behind. In the pic to the right the character is moving right, and the gun is lagging behind and getting hidden behind them.

    The upper body is pinned to the legs, and the gun is pinned to the hands. The upper body doesn't lag at all.

    I don't feel like I'm doing anything wrong. Why is this happening?

  • Simple!

    Set the width of the line to be equal to the distance of the two objects. Set the origin of the line to be at the right end (I think). Set the angle of the line to be the angle towards the other object from the original object. Set the position of the line to be on the original object. This is basically how line of sight can work. The line is just a long stretched out box. It should look fine if it's just one color with no texture.

  • There is a property called object.imagepointX(0) or something along those lines. It will give the world coordinates of that objects image point. Set an object's position to that value and it should do the trick.

  • I got a small prototype that I just want to add the controls for within the HTML file itself and looking at the HTML code, I have no idea how to do it. Maybe the text is appearing behind the game because it takes up the whole webpage but I don't know how to change that either.

    https://dl.dropboxusercontent.com/u/728 ... index.html

    The file is here. I'm just wondering what I need to do to add a paragraph at the top. Doesn't have to be fancy.

    If anyone could help me out it would be super greatly appreciated. And if you want to play you need a controller.

  • Here's one way you can do it. Assign the movement to a box and assign the position of the animation to that box, but instead of setting it directly to the position of the movement box, do this: (Set X to round(PlayerBox.X))

    This way it will snap to the nearest whole number. If you have double sized pixels you will have to do a little bit of math. Also I'm not sure if this works on full screen mode.

  • Pretty sure I came across something in the forums recently that did this, but for the life of me, can't remember what I was looking for when I came across it. I do remember r0j0hound was the one who solved it (no surprise there). I'll see if I can't find it again..

    still got a couple of his capx links in my downloads folder

    see if these help:

    https://dl.dropboxusercontent.com/u/542 ... _phys.capx

    https://dl.dropboxusercontent.com/u/542 ... annon.capx

    This is really cool. Unfortunately I'm using the Bullet behavior, not Physics. I don't understand it well enough to convert it to Bullet.

  • So I took a stab at it. It's kinda ugly right now but it works.

    Basically I'm creating 2 bullets, one for the biggest possible angle of accuracy and one for the smallest. These two projectiles create a cone at which the bullet will travel. I increase their timescale to make them go faster than the bullet without changing the speed of the bullet (changing the speed would change the trajectory).

    There's a bit of delay in the markers of course but it's better than nothing.

    If anyone knows a better way please let me know.

  • //Note: whoops, misread your post. Thought you were talking about enemies firing at the player. Left the above in case that might be helpful. The bullet speed equation would be unchanged; all you need to do to the angle equation would be to change 'Set AngleToTarget to...' the following:

    Set AngleToTarget to angle(PlayerX/Y,MouseX/Y)

    //If you want, you could do a projected mouseX/Y counting in gravity, etc, or maybe you want player to compensate manually? Anyway...

    Well, It's easy to draw a straight line from the gun to the mouse position. What I want to do is draw a line, or 2 lines that compensate for gravity, the accuracy of the projectile (A random +- angle of the gun, hence 2 lines for the min and max angle difference) and the velocity of the projectile, all of which change as the bullet charges longer.

  • Instead of using the simulate jump action, make the first jump be used the same way that the second jump is used (setting Y velocity).

    The simulate jump action can only be done if the player is on the floor, but if you want the player to be able to jump in the air that would be a way to do it. Haven't looked at the code but I hope that helps.

  • Hi!

    I'm making a defense based shooter and one thing I would really like adding is a predicted trajectory pathway cone, or something similar to it.

    Here's the game in question: http://www.newgrounds.com/projects/games/732780/preview

    Basically, the main projectile launcher increases the speed and accuracy at which it launches projectiles as it charged, so this trajectory would have to update in real time for it. The projectiles are also gravity based and aimable (go to the mouse position) and use the bullet behavior.

    The closest thing I can think of is making fake markers with the bullet behavior leave the cannon (aiming at the mouse position) at increased DT, but I don't really think that would work very elegantly.

  • I'm working on a physics based game and I'm trying to figure out how to allow players to jump, but not jump when they are in the air.

    That is easy enough to do by itself, but I'm not sure how to prepare that for the case when they fall off a ledge.

    For instance, if the player touches the ground, they can jump. If they jump, they can't jump until they touch the ground again. But there's no event for detecting the lack of a collision happening, so I can't make the player unable to jump after they walk off a cliff.

    Is there any way to fix this only with the physics behavior?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So in the picture which is the object to push and which is the explosion? Normally an explosion is round so the angle to push the object would be angle(explosion.x, explosion.y, obj.x, obj.y).

    It's possible to calculate the point of collision between a circle and a box but it's not really trivial. In your picture at least the angle from 1 to 2 is not much different than 1 to 3. I guess I'm not fully understanding the issue. Could you post a capx perhaps?

    Yes. That's what I'm doing. However, point 1 is obj.x, obj.y, and the line connecting point 1 and point 2 is the angle of propulsion, even though the contact point is at point 3, and the expected angle is closer to that of the line between point 3 and point 2.

  • I'm not sure what line you mean by the other one. Do you mean point 1 to point 3?

    It looks like you can get point 3 with (x2, y2+radius) if that helps.

    Yes, not necessarily the coordinates of point 1 to point 3, but the angle. That formula unfortunately doesn't help me very much because I'm looking for the coordinate of, or the angle to the point of impact between the circle and the rectangle.

  • So I'm basically trying to make this explosion push things outwards via physics impulse with this formula as the angle "angle(self.X, self.Y, ExplosionBox.X, ExplosionBox.Y"

    However, it pushes the objects in a very strange direction. As you can see from the picture, there are 2 lines. The line between Point 1 and 2 is the angle that the objects are being thrown at, but I would rather have an angle like the other one. How can I go about this? Is there a way for me to get the coordinates for point 3?