Keep an object centered and looping layout?

0 favourites
  • 2 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • Hey guys and girls,

    So this is my first post here, so I'll try to give you as much information as I can, since this has baffled me for a while... to be honest I could probably have given this a better title, but I don't really know how to word it without using lots of text, lol. Here goes...

    Right, first of all, what I've got:

    A layout at 640x640

    A tiled background (The sprite is 32x32)

    A player sprite, using the car behaviour

    Enemy sprites using the bullet behaviour

    On the player sprite, I've got wrap and scroll to, since I need the player to always be in the centre of the screen, and as it is, it works, however, once I reach the edge of the layout, the sprite is no longer centred, hopefully you know what I mean by this.

    I'm trying to make the player sprite always centred, even when at the edge of the layout... this is where it's baffling me:

    In order for the player to be centred, I need to remove the boundaries of the layout, I thought this could be done by using the Unbounded scrolling option on the layout properties, and it works to a certain extent, the player DOES stay in the middle, never touching the edges of the screen, which is what I want, but you can see the edges of the background tile, and even when I extend the background past the edges of the layout, while playing the game, you can still see the edges of it, and a white background behind it...

    Now, onto another matter which involves the enemy sprites... once they reach the end of the layout, they wrap around to the other side, but they sort of teleport to the other side, whereas what I want here, is, well, I'll try to explain it a different way:

    I want the layout to become... how do I put this: infinite. So you can drive (The player is a car) forward forever, and the background will always loop no matter which direction you're moving, but I sort of want the layout to loop, otherwise when enemies move off the edge of the layout, they'll just teleport away back to the other side, I don't want that, I want them to continue in their direction.

    I really have no ida if I've explained this well at all, and I'm very tired (I'm from the UK, so y'know, it's 1:50am at the moment) and not thinking straight at the moment, so I apologise if it's hard to read or if I'm not making sense, but I'll check back tomorrow and answer any questions as best I can...


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So, after trying at it again for some time, I'm not any closer, and I don't think what I want can actually be achieved, and if it can, only by wizards, lol.

    If anyone would still like to try and help though, that'd be great, since I can always come back to it!

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