Skip to main content

News

Topic: Spriteset Directions (Read 135 times) previous topic - next topic

Spriteset Directions
From my understanding, a spiteset has the 8 cardinal directions (n, ne, e, se, s, sw, w, nw) and each direction has a max of 8 image frames.  You can create other "directions" in a spriteset such as idle, battle, cast etc...

From my own usage, my Armos statues have the directions plus 10 others all named after the different color versions (Red, Green, White, Black, Gold, etc...)

With my Armos, to determine the color sets, I use SetPersonDirection("Armos", "red");  as an example.

My Link sprite has 9. The 8 directionals and one other for item and Triforce collection. You know, the classic Link faces the player and holds the item above his head. It is currently set as "collect". I've tried a variety of different names thinking "is there a typo? is it lowercase or capitalized?"

I'm coding the final room of level 1, where the Triforce piece is located. The Triforce is also a spriteset, 4 directions (n,s,e,w), 3 images per direction (making it flash). I have it set "On Touch" to SetPersonDirection(MainChar, "collect");

When I go to test it, I walk up to the Triforce and it does nothing. I got to thinking that maybe, MainChar was still moving, so I placed a DetachInput(MainChar); before the SetPersonDirection. Walk up to the Triforce piece to collect it and the character stops walking, no input at all but still won't update the directional to "collect."

I really can't figure out why that would be when I use similar methods with other spritesets and directions that aren't one of the cardinals, like the Red, Green, White....

Any ideas what might be causing this?
  • Last Edit: September 10, 2017, 07:12:03 am by Miscreant
"I am to misbehave." - Malcom Renyolds, Captain of Serenity

  • Rhuan
  • [*][*][*][*]
Re: Spriteset Directions
Reply #1
You probably need to use ClearPersonCommands(name) after DetachInput and before SetPersonDirection.

Movements are queued, and executing a queued movement will result in turning to the correct direction for it.

So in the current situation, what's likely happening is this:

1. Player is pushing up to move north towards the triforce
2. on contact with the triforce there is still at least one "move north" left in their queue from pushing up
3. You detach input (stopping them from queuing any more but there's one left
4. their direction is set to north
5. BUT before that can be seen the movement queue is processed and they attempt to move north again - hence changing to face that way

If you add in a ClearPersonCommands(MainChar) after detaching the input and before changing direction this should fix it as detaching input prevents any more movements being queued and ClearPersonCommands deletes the current queue.

Re: Spriteset Directions
Reply #2
@Rhuan  Thank you. That corrected one issue I'm having with the Triforce coolection routine.
"I am to misbehave." - Malcom Renyolds, Captain of Serenity

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Spriteset Directions
Reply #3
Quote
and each directions has a max of 8 image frames.
Wait, really? I had no clue that there was a limit to the amount of frames! Never encountered it, anyway.

Re: Spriteset Directions
Reply #4
Quote
and each direction has a max of 8 image frames.
Wait, really? I had no clue that there was a limit to the amount of frames! Never encountered it, anyway.

Straight from sphere.chm included with Sphere 1.5
  • Last Edit: September 10, 2017, 07:12:19 am by Miscreant
"I am to misbehave." - Malcom Renyolds, Captain of Serenity

  • Rhuan
  • [*][*][*][*]
Re: Spriteset Directions
Reply #5
Quote
and each direction has a max of 8 image frames.
Wait, really? I had no clue that there was a limit to the amount of frames! Never encountered it, anyway.

Straight from sphere.chm included with Sphere 1.5
That was version one of the .rss format, if you make a spriteset with the 1.5 editor (or sphere studio) it will be a version 3 .rss which has no frame limit.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: Spriteset Directions
Reply #6
Yeah, there are 3 versions and RSSv3 has no limit (technically it does since the fields are 16-bit but that's like 65,000 images).  With Sphere having such a rich history I ended up having to support every single version in miniSphere, the function to load .rss files is a nightmare :o
miniSphere 5.0b4 (stable: 4.8.8) - Cell compiler - SSj debugger - thread | on GitHub
For the sake of our continued health I very much hope that Fat Cerberus does not become skilled enough at whatever arcane art it would require to cause computers to spawn enourmous man eating pigs ~Rhuan