Author Topic: [Solved] Spike ground: ┐tile or sprite?  (Read 1367 times)

slime

  • New Member
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
[Solved] Spike ground: ┐tile or sprite?
« on: Sun, Dec 4, 2011 »
Hello to all,

I'm looking to make some spikes on the ground for the player to die. I've already drawn some as part of a tileset. But I've come across some questions:

-Tiles are 24x24. As the spikes don't reach the top of the tile, player is currently floating when walking on them (there's no dying at the moment). Sprites colliding with FlxTilemap, ┐will always collide with the 24x24 box ignoring pixel content? I mean, ┐could they collide only with non-alpha content?

-Also, thinking about code size and effort, ┐would it be easier to use Sprites for the spikes?
« Last Edit: Sat, Dec 10, 2011 by slime »

camasthecat

  • Contributor
  • ****
  • Posts: 461
  • Karma: +0/-0
  • WOW! 400+ Posts!? Jeez! Do I have a life!?!?
    • View Profile
    • My site for thermalJS, an HTML5/Javascript engine kinda-like flixel:
Re: Spike ground: ┐tile or sprite?
« Reply #1 on: Mon, Dec 5, 2011 »
I would use sprites. They are more editable, if you catch my meaning. They can be any size, and do anything. :)

Kytin

  • Member
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: Spike ground: ┐tile or sprite?
« Reply #2 on: Mon, Dec 5, 2011 »
While you could set the properties for the spike tiles to use a customized collision function (to give a different sized/shaped bounding box, and kill the player if said collision is detected), it might be easier to just use sprites.
On the other hand, if the spikes are part of the tileset then you will probably have an easier time adding lots of them when creating your levels. It might depend on how many spikes you plan to use.
I have seen the future. You will not.

Alextfish

  • Active Member
  • ***
  • Posts: 174
  • Karma: +0/-0
    • View Profile
Re: Spike ground: ┐tile or sprite?
« Reply #3 on: Tue, Dec 6, 2011 »
Either approach can be made to work. There are tradeoffs such as those you've mentioned. I'd say choose one and go with it. Perhaps a guideline could be that if you're envisaging levels with hundreds and hundreds of spikes, then make them a tile, otherwise make them a sprite; but it shouldn't really matter, as either way can work.

auriplane

  • Snails!!
  • Contributor
  • ****
  • Posts: 497
  • Karma: +1/-0
  • Snails!!
    • View Profile
Re: Spike ground: ┐tile or sprite?
« Reply #4 on: Tue, Dec 6, 2011 »
I went with sprites in snaily game, so that I could easily reduce the hitbox to give the player a margin of error.  Certain parts of my game were much more frustrating before I did that :-)

camasthecat

  • Contributor
  • ****
  • Posts: 461
  • Karma: +0/-0
  • WOW! 400+ Posts!? Jeez! Do I have a life!?!?
    • View Profile
    • My site for thermalJS, an HTML5/Javascript engine kinda-like flixel:
Re: Spike ground: ┐tile or sprite?
« Reply #5 on: Tue, Dec 6, 2011 »
Yeah in my game there are "rooms" that the player explores. Sprites only exist in the current room. That makes it go quick and snappy! :D

slime

  • New Member
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: [Solved] Spike ground: ┐tile or sprite?
« Reply #6 on: Sat, Dec 10, 2011 »
Thank you very much to all.