? Making a Shoot 'Em Up Game, but still with some doubts. (Page 2) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Making a Shoot 'Em Up Game, but still with some doubts.

1 2
  • #21 ✎ 930 random_god Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Video Games I like to play video games! Hobbies Ok, this is a fairly simple problem. You put MID$(MAP$,I#,1) The problem with this is that MAP$ is an array, not one string. In the FOR loop you go FOR I#=0 TO LEN(MAP$)-1 because LEN returns the number of elements in the array. But in MID$, it returns a section of a string. If you try to make MID$ read a section of an array, it won't work, even if it's a string array. You would need to tell it where in the array to look at: IF ASC(MID$(MAP$[I#],J#,1))>=ASC("A") THEN '... This way it gets a single string rather than a whole array. EDIT: Also, when looking through the map, we had 2 loops, remember? We need these for the enemies, too. One for X and one for Y. You already know how to do this. FOR I#=0 TO LEN(MAP$)-1 FOR J#=0 TO LEN(MAP$[I#])-1 IF ASC(MID$(MAP$[I#],J#,1)>=ASC("A") THEN '... NEXT NEXT Posted Edited by random_god
  • #22 ✎ 213 the_squat1115 Minecraft Is Awesome! I love Minecraft! Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies That's what I've learned now: FOR I#=0 TO LEN (MAP$)-1 FOR J#=0 TO LEN(MAP$[I#])-1 IF ASC(MID$(MAP$[I#],J#,1)>=ASC("A") THEN '... NEXT NEXT This assigns the sprite's X and Y, isn't it?
    Also, when looking through the map, we had 2 loops, remember? We need these for the enemies, too. One for X and one for Y. You already know how to do this.
    IF ASC(MID$(MAP$[I#],J#,1))>=ASC("A") THEN '... This searches the string I put on the map, in example the "A" string, it searches for it and it places the sprite wanted for it.
    Posted Edited by the_squat1115
  • #23 ✎ 930 random_god Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Video Games I like to play video games! Hobbies
    That's what I've learned now: FOR I#=0 TO LEN (MAP$)-1 FOR J#=0 TO LEN(MAP$[I#])-1 IF ASC(MID$(MAP$[I#],J#,1)>=ASC("A") THEN '... NEXT NEXT This assigns the sprite's X and Y, isn't it?
    Also, when looking through the map, we had 2 loops, remember? We need these for the enemies, too. One for X and one for Y. You already know how to do this.
    IF ASC(MID$(MAP$[I#],J#,1))>=ASC("A") THEN '... This searches the string I put on the map, in example the "A" string, it searches for it and it places the sprite wanted for it.
    Well to position the sprite you need to use SPOFS and judge where to put it based off of where in the string array it was found. But you also probably want a variable system or spawn the sprites only when they come on screen so you don't end up with the enemies continuing to appear after they have already spawned. I'm not sure how you'll do this, as you hinted you want it to change scrolling direction. The way I would do it is have the sprite only spawn at the top of the screen and then it can't spawn any more, but if the scrolling direction changes, that doesn't work well. The only way I can think of is having some sort of variable system, which I don't know how to do.
    Posted
1 2