2

Defender is an ancient game that presents a virtual world, a horizontal scroller, in a loop. The camera view only portrays a portion of the world at any given time. The player can fly in both directions around this world, continuously.

How could this be achieved with an SKTileMapNode Layout of the world?

My first thought is to have two instances of a SKTileMapNode that illustrates the whole world, and abut them in space where and when required as the player flies around the world.

Here's a map of the Defender world highlighted at the top of the screen:

enter image description here

Confused
  • 6,048
  • 6
  • 34
  • 75
  • lol ancient game ... see Resogun on PS4 – Knight0fDragon Sep 30 '16 at 02:27
  • defender would not be a good model layout for SKTileMapNode, any reason why you want to take this approach? – Knight0fDragon Sep 30 '16 at 02:28
  • I'm only using it as an example of a "forever" looping world. – Confused Sep 30 '16 at 02:38
  • well a forever looping world only requires 1 tile map layout, just make sure that the end of the tile map is the exact copy of the beginning of the tile map, about the size of the screen. This way all you need to wrap is the tile index when you hit a certain point – Knight0fDragon Sep 30 '16 at 02:42
  • What do you mean "wrap the tile index"? – Confused Sep 30 '16 at 02:42
  • And don't you think Resogun is more like R-Type than it is like Defender? – Confused Sep 30 '16 at 02:43
  • [ABC123123123ABC] When you hit B at any point, you "warp" to the other B – Knight0fDragon Sep 30 '16 at 02:43
  • no, Resogun IS defender lol you go around saving civilians while fighting aliens – Knight0fDragon Sep 30 '16 at 02:44
  • http://metro.co.uk/2013/11/25/resogun-review-defender-of-the-ps4-4201092/ – Knight0fDragon Sep 30 '16 at 02:44
  • I've played resogun. It reminded me much more of R-Type in its level design and gameplay. There's some aspects of Defender, but it doesn't play like Defender. – Confused Sep 30 '16 at 02:49
  • Would this kind of warping have a noticeable impact on anything? Like a judder or frame loss? If it works, it's a mighty elegant solution. – Confused Sep 30 '16 at 02:51
  • not sure what you played, RType is a shmup, left to right only. You wrap the world in Resogun, trying to save (defend) the dudes in those boxes – Knight0fDragon Sep 30 '16 at 02:52
  • I am not 100% familiar with SKTileMap yet, but with regular tile mapping, that is how you do it, and it is suppose to be instantaneous. I have done this in regular sprite kit and it is instant, you are essentially just moving the "camera" (not the real camera) if you think about it, but inside the tile map – Knight0fDragon Sep 30 '16 at 02:55
  • Yeah... play R-Type, there's lots of versions. But the bulletstorm hell will instantly remind you of Resogun. Where Resogun fails to capture Defender's best bits is where it feels like R-Type... a slog rather than the wonderful freedom and self determination of Defender. I get the (very) deliberate similarities between some of Resogun's concepts and that of Defender, but in the playing they lost the most special aspects of Defender-ness. There's a fluidity to Defender that few games have ever captured. – Confused Sep 30 '16 at 02:59
  • I'm going to have to try this approach. It sounds too good to be true. – Confused Sep 30 '16 at 03:00
  • yeah if you played legend of zelda on NES, the lost woods used that approach, or final fantasy (or any rpg for that matter) the world map – Knight0fDragon Sep 30 '16 at 03:03
  • I haven't. I've managed to avoid slow and/or long games. Arcade type junky. Sonic is about as slow as I want to go in terms of a game experience. – Confused Sep 30 '16 at 03:11
  • that truly sucks for you then, whole world of entertainment out there – Knight0fDragon Sep 30 '16 at 03:34

1 Answers1

2

The minimap in the screen shot you show indicates it is not endlessly scrolling, it’s just really long, with only a small part visible at any time.

Doing this with SKTilemapNode would involve one SKTilemapNode and adding tiles only for the ground, which you could then attach physics bodies to. The background could be a single image or multiple images to create a parallax effect or you could go with a black colour background and stars created with SpriteKit Particles.

An alternate approach would be to use two background images and position them programmatically so as one image scrolls offscreen, it is moved left or right (depending on which way the user is scrolling) to appear adjacent to the other background image, giving the appearance of an endless scrolling background.

Mark Brownsword
  • 2,287
  • 2
  • 14
  • 23
  • 2
    I remember defender (loved the game) - and it IS scrolling. You keep cycling around the world. – TSG Oct 15 '16 at 03:10
  • And here I was thinking I was the only one that knew and loved this game. I still play it, sometimes, and when I need to be humbled. @TSG – Confused Oct 16 '16 at 15:28