ramones's Forum Posts

  • Think of it as scrolling the camera rather than scrolling the layer.

    System -> Scrolling ->

       Scroll to object

       Scroll to position

       Scroll to x

       Scroll to y

    To scroll to the middle of the layout:

    System: Scroll to (LayoutWidth/2, LayoutHeight/2)

    To scroll continuosly to the right:

    System: Set scroll X to scrollx + 1

    There's also the ScrollTo behavior that when applied to an object will make the camera follow it. That's what's used in the platform example.

    Space Blaster uses an invisible sprite called 'Scroller' and then does

    System: Scroll to (Player.X, Scroller.Y)
  • Check out the pacman tutorial. It uses grid based movement and checks for walls before moving.

    http://www.scirra.com/tutorials/308/cloning-the-classics-pacman

  • To expand on what Kyatric said: points % 10 gives you the remainder when points is divided by 10. So for example, if points = 100 then points % 10 = 0 (100/10 = 10 remainder 0). If points = 101, points % 10 = 1 (101/10 = 10 remainder 1).

    Basically, checking if a number % 10 = 0 tells you if the number is evenly divisible by 10. If you wanted something to happen when points = 6,12,18,24,etc you'd check if points % 6 = 0.

  • Nice, I was wondering if you were still working on this. It's a fun game. The music is great. I like the unpredictable nature of the first boss fight. As he keeps inching towards you and don't know if he'll charge or throw something. Good tension. He didn't have a health bar in the beta. That's certainly an improvement. As is the in-game tutorial.

    I got up as far as the second boss. Couple of minor issues: look what happens when you click repeatedly on the menu button and I noticed a couple of your/you're typos in the bosses speech.

  • So points is a variable?

    System: Compare two values points % 10 = 0

    System: Trigger Once

           Do action

  • Just swap the order of the events, so it checks for ground click first before it selects the sprite.

  • I haven't looked at the capx because it uses a plugin I don't have but I'd guess it's because you're setting the ball to the mouse x, y coordinates before applying the impulse. Same problem as this thread:

    http://www.scirra.com/forum/please-help-with-touch-events_topic54856.html

  • You just need to make sure the values stay between 0 and maxvalue. At the moment you can shoot with 0 ammo and the ammo goes into negative values. You could put an 'ammo > 0' condition alongside 'on left mouse clicked' to stop that happening.

    And when you add or subtract from one of the values... Instead of adding 25 to player.ammo, set player.ammo to min(player.ammo + 25, player.maxAmmo).

    On grenade pickup set player.grenade to min(player.grenade + 3, player.maxGrenade) etc.

    powerbars.capx (r99)

  • How about deleting the element from the array instead of setting it to 0. So the array only contains the numbers you want.

    array1-9.capx (r99)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When you destroy a sprite it doesn't actually get destroyed until the next top level event. So in your case it will be destroyed at event 17.

  • But now I get the weirdest of behaviour: the newly swapped in button also gets clicked event!

    So I click once on an object, and in the onclick event for that object, swap the objects X&Y with a completely differetn object, and the new object also gets an onclick event, even though there has been no click on the second object.

    Is this a bug do you think?

    Nah, it's just that when you click the mouse it will go through all the click events on the event sheet. It checks event 1, sees you've clicked on button 1 and then hides that button and moves button 2 into place. Then it checks event 2 and now button 2 is below the mouse so it counts as a click on it, even though it wasn't there when you first clicked.

    This came up before when someone wanted to show a box by clicking a button and then hide it by clicking on the box. The solution was to toggle a variable with the mouse clicks and then toggle the objects visibility based on the variable. You have to seperate it so the mouse clicks don't interfere with each other.

    toggleMenu.capx (r99)

    Yann's method is better for a toggle button.

  • There's a plugin that lets you print to the console:

    http://www.scirra.com/forum/log-text-objects-to-chrome-console_topic47859.html

    I haven't tried it myself, I generally just use text objects.

  • I'd go for option 2. Use a variable to check if a button is active.

  • However, if you want to do something like "Mouse->Cursor is over" you have to pick one of your 9 tiles - is there any way to say "any tile object"?

    If you put all your tile objects in a family called Tiles, then you can do "Mouse: Cursor is over Tiles".

    Or if you have 9 copies of one tile object, you could give them an instance variable called 'id' and set it to 1,2,3,4, etc. Then to pick a specific tile you can use 'tile: id = 3'.