AllanR's Forum Posts

  • well, the single clicks always fire, so just keep track of the dt between two right clicks, and if it is less than a threshold (probably 0.5) then treat it as a double-click

  • 3DDelfin

    like Plinkie said, it wasn't really clear what you are trying to do...

    so I took a guess: (that if you are dragging one object, but the mouse moves over another one, you want to swap and start dragging the second object)

    https://www.rieperts.com/games/forum/mousedrag.capx

    if you have more than one object type then you should put them in a family to keep the code simple.

    you can tell what is under the mouse by using Mouse - "Cursor is over"

    if you are dragging one object, but then want to switch to another one, they will both be under the mouse, so you need a way to avoid endlessly swapping between the two.

    also, if you have many objects on screen, over-lapping, you have to know when it is ok to swap objects, and when to ignore them...

    if you meant something completely different, like clicking on an object to drag, but want to change that to a smaller version thumbnail while dragging it, then you wouldn't need all the ignore code...

  • tinbashingstudios

    are you making a space ship or ship on the ocean? I am not sure what you mean by seeing the whole layout and needing parallax. (for parallax to work you have to have layers extend beyond what is on screen). Do you want the background to loop behind the ship?

    I would make an invisible sprite called Camera - then you can limit its movement any way you want.

    you could check out this thread from a couple months ago:

    https://www.construct.net/en/forum/construct-3/general-discussion-7/scrollto-lerp-front-instead-143258

    I posted a sample that uses a camera object to maximize the space in front of the space ship so you can see what is coming at you. If you download my file, find the Camera object and make it visible so you can see how it changes its position in relation to the ship.

    https://www.rieperts.com/games/forum/spacebackground2.capx

  • I just tested it as well, and you are right - must be a bug. you should file a bug report.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • YoHoho I made a quick demo - roughly based on other path following samples made by ROJOhound years ago :)

    you can add as many nodes as you want - the only catch is you have to set the NodeNumber instance variable consecutively. if you have nodes 1,2,3,4,5,8 it will stop at node 5 because it wont find a node 6.

    you can arrange the nodes any way you want - it will move from one to the next (either up or down depending on the direction).

    https://www.rieperts.com/games/forum/follownodepath.capx

  • the easiest way to do that was to create a global variable to keep track of which player is the active player...

    then I made space bar just drop the active player's weapon.

    I also added press Enter to switch between player 1 and 2.

    to keep it simple to know which sprite body goes with which player, I also added an instance variable to player that holds the UID of the sprite body.

    https://www.rieperts.com/games/forum/weapon_test3.c3p

    there are plenty of other ways it could have been done... Press 1 to drop player1, press 2 to drop player2

    or press g to drop whoever is holding the gun, etc...

  • put the sprite in a family, and check if sprite is put on spritefamily.

    then you will have both instances picked under different names: sprite.x and spritefamily.x

  • WengWeng

    if you just want the box to stay where it is, you can set its "Immovable" setting to Yes.

    you can also change world gravity, depending on what you are trying to achieve...

    as far as I know, you can only make a joint between two physics objects. So, once you make one object immovable to anchor its position, you can make a joint to other movable objects from there.

  • if you want the weapon to follow the hand, then every tick move it to the image point (without using pin - which will lock it at the one location).

    so, you need to pick players holding a weapon, and then do a for each loop so you can pick the correct weapon, and move it to image point "Hand"

    https://www.rieperts.com/games/forum/weapon_test2.c3p

    EDIT: I didn't remove the Unpin actions from earlier events, but since the weapon is not pinned, that wont cause trouble, but obviously those could be removed...

  • there may be a way to paste map pieces into a drawing canvas and then apply an effect to get an outline around the group...

  • It might depend on how long you play, what other tabs are open, what extensions are active, what order things happen in the game. It could be that some change in Chrome made the issue more obvious now for some reason, or something else on your computer changed.

    pretty much every time I have looked into an issue like this, it was because I (or someone else) forgot to destroy explosion instances, or millions of bullets were flying off to infinity, or particle instances were adding up, or some condition was true that continuously spawned an object, and the increased number of objects was bogging down collision checks, etc...

  • MTR

    I tried a few ideas I had, but didn't get very far...

    see this thread from 6 months ago where I made a sample that did something similar (but not outlining the total area):

    https://www.construct.net/en/forum/construct-2/how-do-i-18/check-mouse-sprites-139913?kws=france.capx

    I thought you might be able to use scale to make copies of the occupied map pieces, tint them to the border colour you wanted and move them under the real pieces so just the over-all outer edges were visible, but because of the irregular shapes, scale did not produce an even outline. So, that means you will probably have to make two copies of each map piece - one without a border, and one with a border. And then have two layers of pieces - with the pieces with a border under the ones without. The main problem is what happens when two players' map pieces are side by side - which way does the border extend? if the border does not extend past the edge of the map piece, then you will need border pieces for each edge of each piece and work out what to show.

    you could also try putting image points all around the map pieces and use that to calculate where to draw a border, but that wont be easy either...

  • CrudeMik

    I would run the game in debug mode and see if you are adding more and more objects (bullets, or enemies, or loot, etc.) I bet something is building up in the background that isn't visually obvious.

  • minipill

    event 2 checks for a collision between "weapons" and "player"

    but then in sub event 6 you are moving the weapon and pinning it to "Sprites" family. But there is no Sprites family picked, so it is not using the one you want.

    in event 6 move the weapon and pin it to the player family instance (which is picked because of the collision triggered in event 2).

    You are on the right track... it is a good idea to pin images on top of a hidden player object - that allows you to customize the character, change armour, weapons, etc. But you should always pin everything to the base player object, otherwise there is a slight lag when things are moving which doesn't look good.

    (so, you don't want to pin a body to the player, then pin an arm to the body and then pin a weapon to the arm...) pin everything to the player, and they will all move together the way you want. But that can cause issues with being able to animate things the way you want. If you need complex moving of multiple parts, then you should use something like Spriter.

  • minipill

    EDIT: I didn't refresh the screen so I didn't see the other replies while I was playing around...

    what is happening is not quite what you think.

    when a player collides with a weapon, you destroy the weapon and spawn a new one on that player.

    however, when you spawn an object from a family, you get a random member of that family... so you don't know which weapon you will get.

    AND spawning a weapon on the player makes the player collide with that weapon, which then causes that weapon to be destroyed and another random one created.

    the reason why it looks like both players are getting equipped is that your collision boxes on the weapons are a lot bigger than the actual image, so when you are moving the players, they are both colliding with a weapon, and then both running the endless loop of destroying and creating a new random weapon.

    So, what you probably want to do is add an instance variable to the weapon family called "Equipped" and set it to false. Then when a player collides, pin it to the player and set it to equipped so the other player wont pick it up if they cross paths...

    https://www.rieperts.com/games/forum/weapon_test.c3p