Author Topic: spriteTranslate not translating if no initial moveTo  (Read 40 times)

Astrosynthesist

  • Newbie
  • *
  • Posts: 40
    • View Profile
spriteTranslate not translating if no initial moveTo
« on: January 05, 2018, 08:03:21 PM »
Two things:
In the Vectrex32 manual on page 63, the code example for "spriteTranslate" uses the call "spriteTranslation"
Code: [Select]
a = linesSprite({{DrawTo,50,0}})
call spriteTranslate(a,{10,10})
Since there is no initial moveTo, spriteTranslate only moves the end point of the linesSprite and not the beginning point of it, distorting the vector rather than translating it.

Vectrex32

  • Administrator
  • Full Member
  • *****
  • Posts: 114
    • View Profile
Re: spriteTranslate not translating if no initial moveTo
« Reply #1 on: January 05, 2018, 08:22:29 PM »
Two things:
In the Vectrex32 manual on page 63, the code example for "spriteTranslate" uses the call "spriteTranslation"

Thanks for catching that.

Quote
Code: [Select]
a = linesSprite({{DrawTo,50,0}})
call spriteTranslate(a,{10,10})
Since there is no initial moveTo, spriteTranslate only moves the end point of the linesSprite and not the beginning point of it, distorting the vector rather than translating it.

OK, I can see that. What do you think the correct behavior should be? Inserting a MoveTo into the sprite would be really complicated, and I'd be worried about undesirable side effects.

- Bob

Astrosynthesist

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: spriteTranslate not translating if no initial moveTo
« Reply #2 on: January 05, 2018, 08:43:03 PM »
I'm not certain.
What about inserting a moveSprite ahead of it in the drawing list if there is no initial moveTo?

Astrosynthesist

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: spriteTranslate not translating if no initial moveTo
« Reply #3 on: January 05, 2018, 08:58:39 PM »
What about using appendArrays to append the old array to {{moveTo,x,y}} or have BASIC recognize there is no moveTo,0,0 at the beginning of the array when the sprite is initialized and adding it before creating the sprite in the first place?

Vectrex32

  • Administrator
  • Full Member
  • *****
  • Posts: 114
    • View Profile
Re: spriteTranslate not translating if no initial moveTo
« Reply #4 on: January 05, 2018, 09:26:08 PM »
Having an interpreter alter your array or your drawing list, in an attempt to do what it thinks you meant to do, doesn't feel right to me. And what if the user didn't want the sprite to begin with a MoveTo? Offhand, I can't think of a situation where a user wouldn't want that, but it might happen.

I realize that this is something that people will accidentally run into, and it may cause some head-scratching. But I'm probably going to leave it as-is.

- Bob

Astrosynthesist

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: spriteTranslate not translating if no initial moveTo
« Reply #5 on: January 05, 2018, 10:05:57 PM »
Okay then, strong recommend a note in the manual then! :)