Can Someone Check Out My File?

0 favourites
  • 13 posts
From the Asset Store
Source File, music and art pack for Android Negotiator
  • Hi everyone I pulled an all nighter,No pain no gain

    I was wondering how i can make my premade Grid follow and snap to the grid ingame so i can place tiles more accurate,right now my tiles are going where ever they want and its looking horrible.

    Here is the demo to check out.

    Koolville DEMO

    arrows = movement

    hold left mouse to destroy

    left click an empty space to build is what im trying to achieve but also keeping it with the ingame grid.

    Im also not using arrays.

  • try moving your sprite origin to the bottom right,

    if its still off try an other corner.

  • I don't know how you place your grid right now, surely with a pin to the player.

    Instead, place it by setting every tick the grid position to (round(player.X/tilesize)*tilesize) + offsetX

    (round(player.Y/tilesize)*tilesize) + offsetY

    where offsetX and Y are constants initialized depending on your grid origin. (ho, and remove the pin ^^)

    This way, the grid will only be positioned on tile places, making it a lot nicer. It won't follow the player smoothly though, but you can't have both ^^

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Guizmus Thank you GeneratorX Thank you aswell

    Guizmus i was wondering how i went about that,I have that same code but i did not make it every tick and i also did not take PIN off.Thank you

  • Ok the only issue im having now is,I had my grid sprites sticking to my player with PIN now since i have it off i only have one single cell my grid of sprites will not stick together this way?

    I can only get one single cell to appear and how would i go about pinning this,If i cant use the pin function?

    Guizmus

  • RookieDev

    I'm not sure I understand your question. I can make you an example tomorrow if that's what you need. How did you do it ? Is it working right now ? Can you give a sample capx for testing ?

  • In my Demo you can see that my grid of sprites are all individual sprites that are pinned to my objects position correct?

    Now that i have taken pin off my sprites nolonger stay together as a group of Cells but now there is just one single cell behind my player.If i use this method how can i keep my GRID TOGETHER.

    Hope that makes more sense.And i do not need a capX i just need you to explain it to me if you can.

  • My computer is down right now, so I'm having hard time explaining and testing, sorry.

    I wouldn't use a sprite for the grid, but a tiledBackground, as it's the same sprite repeated X times. With a single object to move, it would be easier.

    If you need to keep N sprites for any reason, then you'll have to add a different offset for each one, and keep track of witch cell is witch (lots of events/variables for this though).

    If you don't use an every tick, how do you do it right now ? a condition "Player.plateform Is moving" could do it (witch is also an every tick with a condition by the way).

    Hope this helps, I'm trying my best ^^

  • Guizmus I had it set as a condition that ran every tick but the platformer movement sounds alot more optimized and actually sounds a hell of alot better.

    I didnt think to make a tiled backround for the grid because i thought that it would register it as only one sprite and not a grid

    I stand corrected,and you are helping alot,I get alot more from the forums than tutorials,I like to be social and hands on thats the best way to learn.Thanks For all of your input and your help so far

  • I am still having issues when my player is on the ground,The tiled grid is not matching up with the blocks i snapped to the grid in my layout,Does anyone else have any clues on how to make this accurate?

    I can see that it is offsetting and i dont know why,When it should be behind my player and snapping to the grid as i walk in an acurate fashion.

    I think i just found out that I cant detect offsetting on a tiled backround! That really sucks i guess i will be going back to using single sprites for this grid.

  • Ok, got my computer back up.

    As I said, a sample capx is always nice to test. I didn't need your project, just a grid, a player, and a ground. So here it is.

    capx

    It's a tiledBg grid, a snap like I suggested with some offset, and a reposition every tick (that can be optimized).

    Also added a click on grid to spawn the ground just to test if the snap to grid was correct.

  • Guizmus This is insane! I had everything setup exactly the same the only difference i had was i was adding some numbers in the expression that shouldnt of been there.Your capX is flawless,I apollogize for not sending my capX file but it did seem like we was able to talk our way around things until i got some numbers mixed up.This is solved thanks to you G-Man i also want to thank you for showing me a different way of rounding <img src="smileys/smiley32.gif" border="0" align="middle" />

  • Guizmus i sent my capX to your PM Box to check out

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)