How To

Help me!!

3

japanese 2020-01-08 09:23

I don't have idea to fix it
please give me some advise

.nx | Open in app
2020-01-08 09:23

was8bit 2020-01-08 19:42 (Edited)

Here you go :)

Some notes:

1) SUBs are are very powerful, if you use them correctly

2) Independent variables inside a SUB are local to inside the sub only, and wont interfere with any variables outside the sub

3) IF you include variables inside the CALL parenthesis, AND the sub changes the values of the matching feed variables inside the variables, THEN the variables used in the CALL command will also be changed... this is a very easy way automatically update variables used outside the SUB

4) Since your maze has a consistent design/pattern that limits movement to whole cell sizes, i have restricted movement to 8 pixels at each arrow press... this means the CELL.C will only get called once player has landed completely into the next cell, making it SUPER EASY to navigate..

There is NO reason or need to call CELL.C while player is in the middle of moving between cells as there is only one direction it can go

This method does prevent reversing movement during this movement, however a quick response from player can go back as soon as movement is completed, AND this mimics the playaction of the older retro games anyway :)

For Japanese.nx | Open in app
2020-01-08 19:42

was8bit 2020-01-08 19:47 (Edited)

Additional notes:

You need to assign the graphic and palette ONCE to a sprite number, unless you want to change them..

SPRITE 0,8,8,1
SPRITE 0 PAL 1

So, as long as the graphic does not change, all you need to add is the x,y location values...

SPRITE 0,newx,newy,

Its is OK to leave the space meant for the character# blank after the parenthesis and NX will use the last set character# :)


was8bit 2020-01-08 20:04 (Edited)

On this one, i have added sprite animation, for when player bumps into a wall...

Notice how i have preceeded use of anitimer with GLOBAL anitimer... this defines anitimer as a special variable that can be seen and used by NX as the same variable if it is in a SUB or not in a SUB ... this makes it easy to use across multiple SUBS...


japanese 2020-01-08 22:03

Thank you, was8bit !
Your explanation was easy to understand.
^_^


was8bit 2020-01-08 22:43

Happy to be helpful :)


gamer_12321 2020-01-09 06:34

You can also see this :

Unnamed Program.nx | Open in app
2020-01-09 06:34

japanese 2020-01-09 07:23

gamer_12321
THANKS^ ^


japanese 2020-01-09 08:24

I understood this program
but one thing I didn't understand well is why ANYTIME=5 ?


gamer_12321 2020-01-09 11:28

I think is to reload the sprite character because if I change it into 0 it makes the sprite character is the #017


was8bit 2020-01-09 11:28 (Edited)

(Gamer is correct :) )

Its ANITIME

ANI is short for ANIMATION.... when ANITIME is set to 5 (you can experiment and use 10 or 15 to see what happens)... it also changes player image to "suprise" or "ouch"... ;) The amount set will determine how long this image is shown before it is reset to its normal image... this creates the "animation" or image that changes for the sprite....

CHECKANI, CLEARANI are subroutines that use ANITIME....

CHECKANI has DECrement ANITIME which subtracts 1 from ANITIME each time the sub is called.... it is used in 2 different places... once in the main loop, when you do nothing, AND in MOVEPLAYER when you are trying to move into a wall... thus ensures the "ouch" image goes away at the same amount of time...

CLEARANI is called in MOVEPLAYER when player moves into an empty space... since i only wanted and "ouch" face when bumping into a wall, i didnt want the "ouch" face when player was moving into clear space, so CLEARANI immediately removes the "ouch" face

Best practice is to use a DO LOOP to help
1) time things like animation
2) seperate different stages of the game (like, one DO LOOP for when player is using a menu, and another DO LOOP when player is playing the game





was8bit 2020-01-09 11:36 (Edited)

Technical note, use WAIT VBL only once inside your DO LOOP... timing wise, this means the loop will execute 60 times a second... (dont use WAIT but that once in the loop)

My ANITIME =5 means the "ouch" face will disappear in 5/60 or 1/12 of a second (depending on what the player is doing, if player insist upon moving into a wall constantly, the "ouch" face will remain constantly)


was8bit 2020-01-09 11:46 (Edited)

Additional note, NX functions on 60 frames a second, which is very fast... however with heavy complicated code you can overwhelm NX and try to make it do more than it can handle before the next WAIT command is reached (WAIT command lets the graphic screen get updated)...

When you overload NX, your program can act irregularly, and also the graphic screen can appear odd... to avoid this use the upper right button when the game is playing and select DEBUG MODE to toggle DEBUG MODE on or off... if it says MAX then you are overloading NX and need to fix your code

As you can see, your game is as 1% so you are fine... >100% shows as MAX and can occur with huge arrays, tons of screen checks, or tons of math being done between calls to WAIT (or screen refresh)

Check out my game

https://lowresnx.inutilis.com/topic.php?id=296

And use the DEBUG MODE ... you will see it runs on MAX, so sometimes odd things can happen while playing the game...


was8bit 2020-01-09 12:05

In my Bugsy game, you will note that i chose to NOT use sprites with smooth animation.. instead I simply let the pieces "jump" from one cell into another cell...

Also, i dont use arrays or store enemies in memory.. instead i use the background as memory... however this means the code is constantly scanning each cell of the entire background... this is why the game reaches MAX as it is reading 1024 cells, and for each cell reading what is in that cell, and deciding what to do with what it finds.. so at 60 frames per second, my game is reading and responding to over 60,000 cells per second.... that is a LOT of processing....

... i had experimented with loops and one set of 1000 in a loop tasks NX at 40%, and 2 sets of 1000 things tasks NX at 80%... my game would require a minimum of 4 sets of 1000 things would have crashed NX, so in this game i experimented with using a different method and it just barely reached MAX so it barely playes OK ;)


japanese 2020-01-09 13:59

Thank you so much! was8bit and gamer.
Sorry, I'm not good at English , so I thisk I only know a little :(
But almost understood!
:)


was8bit 2020-01-09 16:30 (Edited)

Well, i kinda (barely) study japanese as a hobby (i say that as i self study, and barely know a few random things) ... so I understand language difficulties...

Please, ask as many questions as many times \(^_^)/ that is how we can learn things :)

I am always happy to help if i can :)


was8bit 2020-01-09 17:03

I like studing kanji history for fun ... i see them as pictures that have meaning...

士 scholar + 口 mouth = 吉 good luck

from ancient chinese
https://www.wikiwand.com/en/wiktionary:吉

I also enjoy studying "crests" ...

http://hakko-daiodo.com/main-0

Studying the real japanese language is a big challenge, and really my biggest weakness is vocabulary, as i have none ... memorizing vocabulary is not as fun ... but since this is just a hobby i focus on the fun things ;)


japanese 2020-01-09 22:35

Thanks , was8bit.
You're very kind person!


was8bit 2020-01-09 23:14

I try to treat others with the same consideration I would like to be treated with (the golden rule) :)


gamer_12321 2020-01-10 15:52

;)


Log in to reply.