LoginLogin

Multiple questions. Can't move on with my game until I figure out how to do these.

Root / Programming Questions / [.]

Tiger2Created:
I have multiple questions. 1. How can I use GCOPY to copy a gpage so that when my sprite is side scrolling the background repeats itself? 2. How can I make is so that one gpage is scrolling along with my character, while another gpage remains still? 3. Sphitsp. I don't get it, I have this program I trying to make. I used SPCOL before my loop, and the sphitsp in side of the loop. I then told it to end the program if I it the sprite. Yet it won't work. I tested it outside of the game where I had only two sprites for testing and it worked then, but not with the program now. Why won't my sprite regester hitting only in THIS CODE? 4. How do I make it so when I attack, the sword pops out and then disappears while at the same time following my sprites movement without pausing it everytime it comes out? I tried Spchk, but it still won't come out and disappear when I tell it to. 5.Why won't bgscreen work when I specify Xscreen 2? Even if it doesn't work in Xscreen, what can I do so everything scrolls with my character if it can't be used while at the same time the touch screen can be used. 6. When I use data like this:
DATA "   1 1                     "
DATA "   1 1                     "
DATA "   1 1                     "
DATA "   1 1                     "
DATA "   1 1                     "
DATA "   1 1                     "
DATA "   1 1                     "
This is how I want my map to be so I can rotate the whole thing later so I can make long maps. But when I do, the whole thing messes up and I can get the bgtiles to face the direction I want. I know it can be done, because this is out gogoshino was done.

1. Type GCOPY and look at the documentation. (blue question mark) Despite it being translated poorly at some times, it still works. 2. BG tiles would work better for the moving foreground. GOFS is your friend for the background. 3. I have no idea how SPHIT works... will edit with more info soon. 4. Maybe use a SPANIM with the sword graphic on the sword sprite for 15 frames, then once it's done animating (check status with SPCHK) hide it. Wouldn't recommend SPCLRing it because it's most likely used a lot.
IF BUTTON(2) AND #B THEN:SPSHOW SWORD_ID:SPANIM SWORD_ID,"I",15,145,1
IF SPCHK(SWORD_ID)<1 THEN:SPHIDE SWORD_ID
5. Check if you have background layers allocated. The top screen and bottom screen share 4 background layers, as well as splitting the 512 available sprites. To change the number of background layers and sprites given to the top screen, use the optional second parameter and the optional third parameter.
XSCREEN 2,256,3 'Gives the top screen 3 layers and 256 sprites to work with.
'This gives the bottom screen the remaining 1 layer and other 256 sprites.
6. I don't quite understand what you're asking in this one. If you're asking about how to make maps good, it's better to load maps from DAT files, which are essentially arrays that you can load. Plug for one of my programs: To easily load and create maps, use the V360 Map Editor, available in V360 Grab Bag, only on SmileBASIC Source! ======== Unrelated protip for easy scrolling backgrounds: if you want to keep a value (x coordinate, coins, whatever) in-between 0 and some other value, and wrap around, use MOD
C=0
WHILE 1
 VSYNC 15
 C=(C+1) MOD 15 'Limit to 0->14, wrap around
WEND

Thanks...but i still need help. i need to make my stage with data instructions. i can do that. but i want them to be long missions. so i want to place bg tiles in the data instruction vertically. but then i have trouble flipping the bg tiles so they dont appear to be vetical but horizontal. as for the pro tip, im not sure what you mean. Ive never used mod before. apologies for the lack of apostrophes. im writing this from my vita...

3- Maybe you should share the implementation or key of your game on this one. This is how I use those functions. # 1. CALL SPCOL ON EVERY SPRITE THAT COLLIDE BEFORE THE GAME LOOP START. # 2. For each sprite that collide, I use a function like this
DEF handleCollision SP
 VAR SP2=SPHITSP(SP)
 WHILE SP2!=-1
   ' HANDLE COLLISSION
   ...
   
  ' GET NEXT SPRITE MANAGEMENT NUMBER
   SP2=SPHITSP()
 WEND
END
4- Something that's missing in TheV360 answer is that you can use SPLINK to keep the position of the sword relative to the position of the holder. That way, the sword will follow the other sprite if its moving.

Thanks...but i still need help. i need to make my stage with data instructions. i can do that. but i want them to be long missions. so i want to place bg tiles in the data instruction vertically. but then i have trouble flipping the bg tiles so they dont appear to be vetical but horizontal. as for the pro tip, im not sure what you mean. Ive never used mod before. apologies for the lack of apostrophes. im writing this from my vita...
Have you tried the BGROT command? I haven't used it but I'll try to mock up what it might look like (I apologize if I used it incorrectly). You may have to reset the BGOFS so that it lines up correctly.
DEF CreateMap
 VAR I:VAR BX,BY
'your DATA to BG code here, or called as a separate DEF
 FOR I=0 to 3' number of BG layers to use
  BGROT I,90:BGOFS I,BX,BY' BX and BY being the BG position. You will have to set this
 NEXT
END

Thanks for your input. I have used bgrot but it didn't quite work right. An anyway, I have a request if someone can help me. Make a small, short cord, (please test it to make sure it works) that deals with nothing but bg collision with sprites. There is no background color, or even a game to play at all. It should simply be a sprite that can be moved with the directional pad and circle stick that collides with the bgtile.