SmileBASIC Community
ClaytonDarkClay88
10/07/2016 12:37 AM ·Spoilers
Need help with two things.
1. How do I move with the circle pad? 2. How do I make my background move when my character moves and stop when it reaches the end.
Share this Post
Comment
This post has no comments.
-
10/08/2016 12:36 AM ·Spoilers
How would I move the sprite with the circle pad and still animate it?
Yeahs0Played -
10/08/2016 7:55 AM ·Spoilers
have a few if statements that check what direction the sprite is going. 'X/Y=SP X, Y OLDX=X OLDY=Y 'PUT THE SPRITE MOVEING CODE HERE IF OLDX>X THEN 'finds out if the sprite has moved left. Put animation code here You can have multiple IF statements to check what direction the sprite is going in: OLDX>X' left OLDX<X' right OLDY>Y' up OLDY<Y' down
Yeahs1Played -
10/08/2016 10:34 AM ·Spoilers
You need the following things to make a camera: -Variables to store the position of the camera. -A invisible sprite(Call this the camera sprite) with management number=0 -The speed of the camera. -SPLINK all the sprites you create with the camera sprite Then you need to declare the functions:
Yeahs1Played -
10/08/2016 10:38 AM ·Spoilers
VAR cameraX%=0,cameraY%=0,cameraVX%=0,cameraVY%=0 VAR cameraBG[0] DEF moveCamera VX%,VY% cameraVX%=VX% cameraVY%=VY% END
Yeahs1Played -
10/08/2016 10:38 AM ·Spoilers
DEF renderCamera VAR I INC cameraX%,cameraVX% INC cameraY%,cameraVY% SPOFS 0,-cameraX%,-cameraY% FOR I=0 TO LEN(cameraBG)-1 BGOFS cameraBG[I],cameraX%,cameraY% NEXT cameraVX%=0 cameraVY%=0 END
Yeahs1Played -
10/08/2016 10:44 AM ·Spoilers
Also: -You need to put renderCamera in the part where your code render the changes of the game. -To move background, you need to push the layer on cameraBG Then just call moveCamera somewhere in your code(Try in the one that control the player) to test it.
Yeahs1Played -
10/08/2016 11:26 PM ·Spoilers
There's apparently an error on line 20. This is a little too big for me to comprehend, can I have more examples so I can understand it a bit more? :)
Yeahs0Played -
10/09/2016 1:06 AM ·Spoilers
The problem in your code is that the argument of BGOFS are on line 20. Put BGOFS cameraBG[I],cameraX%,cameraY% in the same line. I use this code on a map editor for my tactic rpg game. It's still a work in progress but it is too complex to use it as an example. If you have a code where you want to add the camera, then I can try to add it for you. If not, then I could share my project.
Yeahs1Played -
10/09/2016 1:10 AM ·Spoilers
I'm trying to make a 2D sidescrolling shooter. I used BGOFS to move the camera around the map. The problem I'm having is the enemies. It's hard to make AI's with BGOFS. It's pretty hard to explain, I would probably have to show you. My question is, will your method help make AI's?
Yeahs0Played -
10/09/2016 1:14 AM ·Spoilers
Would you like the key to the program to see what I mean? xP
Yeahs0Played -
-
10/09/2016 1:26 AM ·Spoilers
The key is: BEENW384 The mummy is suppose to go after the human, but it seems that BGOFS kinda defeats that purpose.
Yeahs0Played -
10/09/2016 2:43 AM ·Spoilers
Here is your code. S223C38E. I put the camera and solved some issues with the AI. I changed a lot of things and left some commentaries on your code. Important things: -Always store your sprites on variables. Right now, the amount of sprites is low, but if you have to do this if you want to handle more enemies on screen. -Use a speed variable instead of hard coding movement.
Yeahs2Played -
10/09/2016 2:52 AM ·Spoilers
Now the problems in your code: -The mummy was following X=0. The player is on the center of the screen so I changed it to X+200. -Try to not use goto. I know that in the examples they use that but it make the code confusing and hard to read. Only use it inside a function(Becuase the goto can only jump to a line inside of it). -Declare the variables that you're going to use(Use VAR or DIM)
Yeahs2Played -
10/09/2016 3:53 AM ·Spoilers
Few more questions, 1. What does SPLINK do in this program? 2. How does adding sprite variables make it better? 3. What does FORMAT$ do? Anyways, Thank you so much! I'm definitely going to include you in the credits. I really don't know how to repay you. xD
Yeahs1Played -
10/09/2016 12:00 PM ·Spoilers
1-SPLINK link a sprite(Child) with another(Parent). This mean that the sprite position is relative to the parent. For example, you can make a Boat (Parent) and a person on it (Child). If the boat moves, then the person will move along with it. The person can move inside it too but he will still move with the boat.
Yeahs0Played -
10/09/2016 12:21 PM ·Spoilers
2- For now your code is simple: you have one player and one enemy. But if you start to add more enemies, then you'll have problems to do the AI if you handle them without variables. You can use arrays to store all the enemies and iterate the values of it to do things, for example validations to know where is the player and then move all the enemies.
Yeahs0Played -
10/09/2016 12:31 PM ·Spoilers
Variables also tell you what you're using in functions. For example, if you read "SPOFS 1,X,Y" in your code, then you won't know what is '1'. But if you read "SPOFS SPPlayer,X,Y", then you will know that the player is moving to the position (X,Y)
Yeahs0Played -
10/09/2016 12:32 PM ·Spoilers
3- FORMAT let you insert variables in a string and define properties to it. For example '%d' is used to put an integer into the string, "%05d" let you put a integer that will use 5 characters(The unused characters will be '0'). In the code, "%- 5d" let you put an integer that will use 5 characters(The unused characters will be ' ') and aligned to the left.
Yeahs0Played -
10/09/2016 1:19 PM ·Spoilers
So if I wanted more enemies, would I have to make another Variable called like SPMUM2?
Yeahs0Played
Add a Comment
You must sign in to post a comment.
Sign in using a Nintendo Network ID to connect to users around the world by writing posts and comments and by giving Yeahs to other people's posts. You can create a Nintendo Network ID using your Wii U console or your system in the Nintendo 3DS family.
Report Violation to Miiverse Administrators
You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.
Report Violation to Miiverse Administrators
You cannot report posts made automatically by a software title.



