Sprites
Make a main loop such as
@mainloop
gosub @playersetup
gosub @move
Gosub @bg
Gosub @background
goto @mainloop
In other post I will explain every Gosub.
@move
vysnc 1
b=button()
if b==1 then y=y-1:spchr 0, (the control number for the sprite that appears to be moving up)
if b==2 then y=y+1:spchr 0, (the control number for the sprite that appears to be moving down)
if b==4 then x=x-1:spchr 0, (the control number for the sprite that appears to be moving left)
if b==8 then x=x+1:spchr 0, (the control number for the sprite that moves right)
Add a return to the end of that one
I forgot what bg was XDDDD so lets move on to
@background
You can do what you like
just type in Bgfill then read what it has to say ^_^
if you want to create boundaries then simply type
Print "X- ";x
print "y- ";y
then when you have your sprite moving look at where the X and Y are at and make this
If x<(number) then x=x-1
Experiment ^_^
Now making enemies i am certainly not a pro at but... I'll give you my best advice.
So if you're making an enemy system that consist of you running into them I have NO CLUE (i'm sorry...)
However if you want to make a classic style Walk a certain number then you run into an enemy then do this :
Okay so back track go back to where you made your player move ^_^
add to every command in that branch
if b==1 then y=y-1:spchr 0,(number):steps=steps+1
now go to your @enemycount
vysnc 1
if steps>50 then steps=0:beep 4:gosub @enemy
return
@enemy
(lets say you want to make it totally random)
ene=rnd(5)
If ene==1 then gosub @level5e
If ene==2 then gosub @level10e
If ene==3 then gosub @level15e
If ene==4 then gosub @level20e
If ene==5 then gosub @level25e
return
If you want a battle to happen on contact you could do this:
Spset 1,sp 'sets enemy sprite
Spcol 1,true 'sets a hit box
If sphitsp(0,1,1)>0 then
' put the battle here
Endif
While the general idea of that code is right, I spotted a few of flaws. For one, do NOT put SPSET in a loop. There's no reason why you need to initiate the sprite every frame. Also, put VSYNC 1 on the line after @MAINLOOP, rather than in the GOSUBS. Also, instead of IF B==# for input, do IF B AND #. This will allow multiple inputs at a time.
Hopefully you understand what all this means. If...
you don't, you may want to consider taking a step back and starting with something simpler. An RPG uses a ton of different programming concepts, and it's crucial you understand what you're actually doing, else things will get really frustrating really fast. In my opinion, before starting on a big project, I think you should know enough about programming to be able to figure most stuff out yourself
Adventurer, what I meant by the text-based game question is that you need to know how to program something and program it well before you can make that something worthwhile. You need to start from the basics, with simple input, print, and if commands.
adventurer, even a text based rpg is above your level right now. you need to press the command reference button on the smilebasic keyboard and check through all the commands and try them out.