Tobye's Forum Posts

  • skylight - This really had me banging my head against a wall too. Luckily, a member of the clay.io forums wrote me out an entire step-by-step guide! Go here and scroll down to 3division's post. I won't lie, it is still pretty confusing, but fortunately you don't have to understand, just do exactly as it says and you'll get there :) Hope it helps!

  • EDIT: I ended up changing everything around so am no longer in need of help. It was a real mess, but now it looks pretty clean and works very well indeed. I will post something up when I have it 100% so everyone can make 1-touch RPGs with ease.

  • ramones - great, thanks!

  • Thanks ramones! I also found this: scirra.com/forum/what-is-x_topic56698.html

    It talks about 'absolute' (or canvas) being the pixel co-ordinates of the screen, which is very useful as well, but I can't quite figure out how to use it. In the expressions it has 'CanvasToLayer' and 'LayerToCanvas', but they aren't too clear on how they are used. Don't suppose you know?

  • justifun - I want it to spawn at a certain area on-screen, no matter where the screen is, not a certain point on layout. So if I use layout layout.width/2, and the width of the layout is 1280, it will always spawn at 640. So if my screen size is 480 wide, and I am scrolled all the way to the end of the layout, the position of 640 won't even be on the screen. I hope that makes sense, I am really tired sorry :(

    I realised just then that I can use my previous method of bushing borders to the edge of the screen and referencing from them, then destroy them after they have been referenced. That will take care of any potential performance issues, but still I would like the eventing to be cleaner.

  • justifun - That's a good idea, but the layout is much bigger than the window. So if I have scrolled say 400 pixels to the right, your method will spawn the object 400 pixels short as it only references the layout and not the window.

  • - thanks! That helps, but only part of the way - I have objects that I want to spawn in all different locations. For example top of the screen +200.

    Using your method and knowing my resolution enables me to place things fairly well, but then when screen sizes change it won't work (the screen size is bigger on iPad than iPhone for example. So if I want to spawn something from the top-left corner on both devices, I can't designate co-ordinates in reference to the screen centre. I would need the left and top sides).

    One method I used before was to make a sprite for each side of the screen, and on start of layout go:

    While 'screen top' is on-screen > set 'screen top' Y to 'self.Y-1'

    And do that for each side. It works well enough, however I have concerns about performance by having the extra four objects as it's already scraping in below 30 frames.

  • Hello,

    I am just wondering the easiest way to position an object to, say, the centre of the screen after you have scrolled to somewhere. My layout is 640x480 and I want to position objects to certain places when created.

    So for example, create a sprite in the middle of the screen regardless of where that may be on the layout.

    I have come up with a number of solutions, such as having one sprite in a parralax 0,0 layer and spawning in relation to that, but they have all been really messy.

    Thanks for any suggestions!

  • Hey Savvy001, just wanted to say thanks for posting this up! I probably won't use it any time soon, but I really love little mechanics like this. Great for adding minigames or making small projects very quickly and easily.

  • This is the method I use:

    Bullet: on created > Set angle: *angle(bullet.x, bullet.y, enemy.x, enemy.y)*

    When setting the angle, just copy-and-paste the section between the *s, then change the names from bullet and enemy to whatever you have named your bullet and enemy.

  • Flemming - one of the physics options in an event is called 'Stepping Mode'. It is by default on 'Fixed' which will give you the exact same movements every time, but is not framerate independent. However if you switch it to 'Framerate Independent' it will work at the same speed regardless of framerate. It will then, however, give slightly different results (which can be a good or a bad thing depending on the type of game).

    So if your game isn't counting on having exactly predictable physics results, just switch the stepping mode and that should fix your problems.

  • Could it be that since going to 'Dead' is above restarting the layout in the event, the restarting of the layout occurs after you have already gone to 'dead'? Just a guess.

  • I had this exact problem and what fixed it was making a 'For each' loop. So:

    For each 'enemy' + line of sight 'On' > Rotate towards player + fire bullets + etc.

    It was thankfully a very simple fix for me. If you still have trouble I will try to post a capx for you.

  • Thanks ramones, I was also trying to get something like this for a while! I tried pathfinders, but could never set them up right. This is a big help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Jayderyu is right, appmobi and CocoonJS can both do this. I recommend Cocoon though as appMobi has some game-breaking bugs you are likely to run into.