LoginLogin

#SPADD

Root / Programming Questions / [.]

MZ952Created:
So, http://smilebasicsource.com/forum?ftid=841 talks about #SPADD, but I've tried it out for myself and I can't get it to work. I think I'm doing something wrong, but I don't know what. I don't have any programs that use #SPADD for example, so I'm kinda stuck. Here's my code:
SPSET 0,0,0,400,240,1
SPOFS 0,0,0,0
SPSET 1,0,240,400,240,#SPADD
SPOFS 1,0,0,-1
So, these two sprites (defined by separate portions of the sprite sheet for good measure) should appear overlapping, with sprite 1 nearer the front. When #SPADD is designated to sprite 1, it disappears, leaving only sprite 0. Otherwise, (both set to 1) they both just overlap in a big colorful mess. How does #SPADD work? (I've also tested it against BG tiles and no dice.)

cool idk but wanna know

#SPADD is an attribute itself and cannot really be used on it's own. You want it to have additive synthesis and be visible. You must use #SPADD+#SPSHOW or 33. Add the attributes together to get the result you expect: For example: Vertically flipped, rotated by 90° and invisible: #SPREVV+#SPROT90+1 or 18 You must omit +1 or subtract 1 if the attribute is 19 when the sprite must be invisible. Just read SPSET or SPCHR's help description on the second page under Attribute.

Yeah you have to have both SPADD and SPSHOW in the sprite display attribute or the sprite will be hidden. Making show an attribute when SPHIDE exists is kinda dumb... hence why they changed that in SB4 and that's not how it works anymore! Yay! Now you just say #A_ADD.

Ah great, it works now. Lol, I didn't realize that the attribute was a bit mask. Well, it seems like they made ...,ATTRIBUTE a non-optional parameter in those forms of SPDEF and SPSET, so maybe it was just convenient to have show and hide as attributes, instead of just ignoring the first bit or something like that (because it looks like you have to specify something as an attribute, even if you don't want to) for a take-no-action sort of initialization.