How To

Video gamequestions

0

GAMELEGEND 2020-03-13 23:14 (Edited)

I need help with the camera scrolling i know BG SCROLL but things work the way they are suppose to if you have played a old game were you move around you just stay in the middle and the camera moves how do i do that


G-9 2020-03-14 05:29

Bg scroll is only disponible as horiszontal scrolling


Timo 2020-03-14 08:18

There is BG SCROLL and SCROLL.

BG SCROLL copies the cells of a background with an offset. The actual scroll position of the background doesn’t change.

SCROLL sets the position of the visible background area. It doesn’t change the cells. It’s position is in pixel units, so this is usually the command you want to use for smooth scrolling.


was8bit 2020-03-14 08:57 (Edited)

lowresnx://?name=How%20To%20Make%20a%20Game%202%20%282.1%29&program=https%3A%2F%2Flowresnx.inutilis.com%2Fuploads%2FkxcSC4jaH7_How_To_Make_a_Game_2_2.1.nx&image=https%3A%2F%2Flowresnx.inutilis.com%2Fuploads%2FkxcSC4jaH7_How_To_Make_a_Game_2_2.1.png&topic_id=1052


GAMELEGEND 2020-03-14 13:01 (Edited)

I forgot to mention that i also used SCROLL but in a for loop for when x = a certain number but it did not work so now i will see what was8bit im guessing my idea did not work because before it got to the if x = a number x was already above that number


was8bit 2020-03-14 13:23

SCROLL does not auto scroll, rather it just offsets... so if XSCROLL is your variable used, then XSCROLL must keep changing over time to create the illusion of movement...

ALSO, what you want to scroll must be placed in a BG layer #, and the SCROLL BG layer # must match

The link I posted will take you to code that only shows how SCROLL works :)


GAMELEGEND 2020-03-14 13:28 (Edited)

The only thing i dont understand is what is the d array for i change it in the if left and it did not scroll left when i pressed left so is the d array just so the program knows which way to scroll and so that the right sprite show up when you change direction or is there more to the d array


GAMELEGEND 2020-03-14 14:47

Thanks was8bit the xscroll and the yscroll worked


GAMELEGEND 2020-03-14 15:05

When did lowres and and lowres nx coder com out


was8bit 2020-03-14 17:02

NX in its current form for around a year but under development longer than that... lowres original years earlier....

Timo can give more precise answer :)


was8bit 2020-03-14 17:02

Oh, and happy to help on the scrolling :)


GAMELEGEND 2020-03-14 19:36

Ok i need some help i know how to animate size 0 sprite but it is kinda wonky with size 1 sprites


was8bit 2020-03-15 04:47

Yes... just remember this math... sprites of any size start (and are defined by) the upper left corner... so...

If C is the cell number you define the sprite by, for a 2x2 or size 1 sprite, this is the math NX will use to pull cell graphics for its sprite....

C, C+1
C+16,C+17

So if you define your sprite with cell 1.. these are the cell #'s it uses...

1, 2
17,18

If you use cell 63 to define your sprite, NX uses...

63,64
79,80


Now, using cell 1 is easy as you can SEE what your sprite will look like..

Using cell 63 as the upper left corner spreads your images onto different pages in Char Designer, so not really the best place to put your 2x2 sprite


GAMELEGEND 2020-03-15 05:43

Thanks


GAMELEGEND 2020-03-15 06:47

Why is vbl better for graphics? Is vbl not exactly 1? And if it is 1 what is the point of it?


Timo 2020-03-15 08:50

VBL, good question, this is my answer from the manual:

"WAIT 1 is the same as WAIT VBL, so why is there WAIT VBL? Because it looks cooler and nerdier! A little guideline: Use WAIT VBL in loops for smooth animations and input handling, and WAIT n if you actually want to wait some time."

If NX was real hardware, waiting for the end of the screen refresh (VBL) wouldn't be the same as just waiting some time. But as it's only a simulation, it's the same. So yes, there is absolutely no difference between WAIT 1 and WAIT VBL.


Timo 2020-03-15 08:58

LowRes Coder was published in January 2015.

The first public beta of LowRes NX for MacOS was published in August 2017.


GAMELEGEND 2020-03-15 13:42

So is vbl just there to make it seem more like real hardware


was8bit 2020-03-15 14:24

@gamelegend, yes, Timo has created a virtual handheld gaming system (say like gameboy) that WE can program :)


GAMELEGEND 2020-03-15 14:31

Okay that size 1 sprite thing i have my sprties in the right place I remembered the math
For animating size 0 sprites i use the timer/16 mod number + number
Do i not do that for size 1 sprites becuase i have been doing that for a whole day just a bit diffrent every time and i have gotten really close so am i not suppose to use the timer


was8bit 2020-03-15 17:39

I will pop up something for you that covers all sprite sizes :)


was8bit 2020-03-15 18:23

I have run out of time... will post later ....


GAMELEGEND 2020-03-15 19:35 (Edited)

I have know idea why i have so many stupid dang problems with stupid sprites if i can just figure out these stupid sprites i could finish the dang demo to the stupid game im really good at programing i shouldn’t be have all this stupid problems with sprties


Timo 2020-03-15 20:33 (Edited)

First check your characters in Char Designer.

>> For sprites with bigger sizes the number of the top left character is the one you need for the SPRITE command. <<

So for example the character numbers could be 4,6 and 8. If you just want to make an animation loop with these three numbers, it could be for example:
(TIMER/16 MOD 3) * 2 + 4
It's MOD 3 because you want 3 different images, then you multiply by 2 to get 0,2,4 instead of 0,1,2, and plus 4 to start with character 4.
The 16 is just the animation speed.


GAMELEGEND 2020-03-15 20:44 (Edited)

Oh that makes sense thanks for the help timo and was8bit


was8bit 2020-03-16 05:27 (Edited)

Ok... an advanced example that should cover anything you may want to do with animating via frames or movement and shown with all possible sprite sizes ::D

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


GAMELEGEND 2020-03-16 06:22

Thanks


was8bit 2020-03-16 08:48

:)


GAMELEGEND 2020-03-16 21:45

I FIGURED OUT THE SPRTIE ANIMATION I DID IT I DID I PROBABLY COULD NOT HAVE DONE IT WITHOUT THE HELP OF YOU WAS8BIT AND YOU TIMO THANKYOU TO BOTH YOU ((caps lock was intentional)


was8bit 2020-03-16 23:23

Always glad to help :)


GAMELEGEND 2020-03-17 16:35 (Edited)

What is the math for collsion detection for a 32x32 map with size 8x8 cells i looked at other programs but they dont use a 32 by 32 map and i cant find out the math for a 32x32 by looking at those other programs


was8bit 2020-03-18 03:28

Are you talking about including SCROLL on the background as well?


was8bit 2020-03-18 03:29

Sprite to Sprite collision check doesn't involve the background at all...


GAMELEGEND 2020-03-18 04:24 (Edited)

No im talkin about for example it stops scrollin if the player is tryin to walk through the ocean or it stops scrollin when they hit a wall is it possible?


was8bit 2020-03-18 05:01

Yes, but you must realize that SCROLL is just an illusion, and the background hasn't actually moved... so you sprite sees the background as it still exists in memory, and NOT as SCROLL makes it appear to be...

Let me put something together that will help with the math.... :)


GAMELEGEND 2020-03-18 05:22 (Edited)

That furit game you made i don’t exactly see how to win i know what you have to do but dont know how to do it and what is the difference between pressin a and b


was8bit 2020-03-18 06:02

Here is your SCROLL math worked out :)

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


GAMELEGEND 2020-03-18 06:05

A lot less complicated and confusing then i thought it might be


was8bit 2020-03-18 06:05

A uses PUNCH and B spits seeds

Punching requires you be very close, while seeds let you be abit farther away (punch/seeds must touch opponents "face" to count)

Punching uses some energy, spitting seeds uses much more energy

Getting punched losses some energy, getting seeded losses much more energy..

The CHEAT variables let you alter the energy levels for all.. a value of 1 is normal play ;)


GAMELEGEND 2020-03-18 06:08

Oh ok


was8bit 2020-03-18 06:09

The math for scrolling is not "intuitive" for me... i always have to think carefully about it to get it right ...


was8bit 2020-03-18 06:17

If you noticed i used +-8 on sprite movement to help make understanding alignment with cells more evident..

You can adjust the -+8 to -+1, but then you will need to use Timo's code for checking for contact as poster earlier...


GAMELEGEND 2020-03-18 06:36

Okay


GAMELEGEND 2020-03-21 13:50 (Edited)

Hey timo how do you get the program featured does it just have to be a really good program and how long does it get featured for


GAMELEGEND 2020-03-21 14:00 (Edited)

Timo one more question i used to be able to use lowres offline but now when i do it offline the code wont load is something messed up or do i now have to be connected to internet now and sometimes the char and bg designers dont open but the sound composer opens just fine so is this lowres or is lowres just fine and my ipad is screwed up it didnt used to do this


Timo 2020-03-21 22:46

All programs are stored on your device and on iCloud. But if you device is full, iOS makes automatically space by deleting local files which are also on iCloud. If you want to open them again, they have to be downloaded.
So to avoid it, make more space (delete unneeded stuff on the device). And then open all important programs in LowRes NX (being online), so they get downloaded again.


Timo 2020-03-21 22:49

About featuring: https://lowresnx.inutilis.com/topic.php?id=943


GAMELEGEND 2020-03-21 23:15

Thats what i thought but then i checked how much icloud storage i have and it said 589.8 mb left and the lowres program that takes up the most only takes up 48kb and all combines they only take up about 90 something kb and in files on the on my ipad it says i have 1.56 gb is there something im missing


GAMELEGEND 2020-03-21 23:18

How much space do you recommend be saved for lowres?


was8bit 2020-03-22 03:18

Your games and downloaded games are included with lowres itself...


Timo 2020-03-22 11:07

Was8bit, the NX programs also appear on the iCloud storage.

But for what I said the iPhone/iPad space is the important one. But I don’t know how much space is required to avoid files become unavailable when offline. Maybe just try deleting some photos or a video, that should be enough.


was8bit 2020-03-22 11:45

... that what i meant ... you say it better :)


was8bit 2020-03-22 11:49

I work across several devices... there is often lag time from one device to another... also when i get impatient and download another copy from the website and edit it on another device it confuses icloud as there are 2 different copies with the same name, making the previous copies unusable....


GAMELEGEND 2020-03-22 14:04

@was8bit ill remember that


was8bit 2020-03-22 16:22

:)


G-9 2020-03-23 15:47

58 REPLIES BEST LOWRES NX RECORD ;)


Timo 2020-03-23 16:14

Well, actually it's bad to ask lots of different questions in the same thread with a generic title, because nobody else will ever find the answers again. Each (unrelated) question should be discussed in its own topic/thread.


GAMELEGEND 2020-03-23 17:24

Thats why i put the questions about lowres questions and the video game questions in different places


GAMELEGEND 2020-03-24 02:10 (Edited)

Is it possible to make a simulation game real 3d or fake 3d could it be possible or would it take up to much storage


was8bit 2020-03-24 06:34

Barely possible with great possibility..

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


GAMELEGEND 2020-03-25 03:24

How do you do music i have looked at tons of programs and i still cant figure out why i cant figure it out i know what MUSIC and PLAY and TRACK and all that stuff i know what it does but i cant get the music to play it just plays the first note over and over


was8bit 2020-03-25 03:29

I have a 3 part "tuturial" you can try out... please feel free to post questions to those threads as needed :)

Part 1: https://lowresnx.inutilis.com/topic.php?id=863


GAMELEGEND 2020-03-27 06:52

So is colllision dectetion really detecting that somthing hit somthing or is it just detecting that something is right in front of something time to stop it from moving


was8bit 2020-03-27 07:07

The only REAL automatic collision detection in NX is SPRITE hitting SPRITE... and it does this at the pixel level....

Although sprites build their graphic data from CHARACTER graphics (as edited with Character Designer) once the sprite gets its graphics, SPRITES behave seperately from the backgrounds ...

Backgrounds do not actually "hold" graphics, they simply reference then charcter# and the palette# there is NO built in code that detects different pixels in the individual characters, so character#2 is completely detected as a whole 8x8 pixel sized cell, even if graphically it only has 1 pixel drawn in it...


SPRITES however are different.. so if you have a sprite size 0 (1x1) just a single cell character, and it has only one pixel in it (color 0 is considered as "empty" colors 1,2,3 are considered as pixels) then that one pixel is all that is used to detect a "hit"

If your sprite is size 3(4x4) and is oddly shaped with say only a few spokes sticking out, then only then actual pixels (non zero colors) are used to detect a "hit" with another sprites pixels...

Collision with background pieces have to be done virtually and manually with code you write... and if say you have a floor that graphically only has pixels in the bottom half of the character, YOU have to allow for that manually in your code or characters will appear to float above the floor...


GAMELEGEND 2020-03-27 07:10

I see


was8bit 2020-03-27 07:18

I would recommend experimenting with JUST sprites and HIT and work out an understanding of these... it is really easy to make little games with SPRITES and just use backgrounds as decoration... SPRITES allow for pixel smooth movements

Alternatively, then, you can experiment with CELL only, restricting movement as "jumps" from once cell space to another... with this approach you can make empty space as "blank" or character 0 to keep it simple at first (using 2 backgrounds is just more to worry about)... CELL.C(Xcheck,Ycheck) is the way to "detect" what character# is at a certain location... :)


was8bit 2020-03-27 07:20

Smooth SPRITE movement among CELL backgrounds is possible, but only after you are comfortable with just SPRITES, and just BACKGROUNDS.. then you can try combining them together interactively :)


GAMELEGEND 2020-03-27 07:23

Ok


was8bit 2020-03-27 07:57 (Edited)

When you are ready to go to sprites and cells collision, check out Timo's work, its what i personally use :)

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


GAMELEGEND 2020-03-27 08:01

right now im testing cell and cell collision playing around with it mostly breaking everything when i just make the program ridiculously insane


was8bit 2020-03-27 08:11 (Edited)

The trick is BEFORE you allow player to move, check the spot they WANT to move first...

Try a simple maze and a player... keep it simple... char#1 is a wall, char#2 is the player... char#0 is empty space...

Then write the code that only allows player movement in empty space :)


GAMELEGEND 2020-03-27 08:12

Ill try that


was8bit 2020-03-27 08:13

Movement is cell to cell... slow movement down with say WAIT 15 after each move (use WAIT VBL in main loop, addd WAIT 15 only after each movement)


was8bit 2020-03-27 08:13


..hmmm... gotta get some sleep... chat with ya later... i will check back tomorrow :)


GAMELEGEND 2020-03-27 08:15

Wait 15 happens to be what i use anways for cells


GAMELEGEND 2020-03-27 16:30

I did the cell and cell collision is there a better way to do it

Sandbox.nx | Open in app
2020-03-27 16:30

was8bit 2020-03-27 17:08

Well done! :D very professionally looking code too :)


GAMELEGEND 2020-03-27 17:10 (Edited)

So is that refresh bg 0 thing that was a good idea right


was8bit 2020-03-27 17:20

Your code works via redrawing the map each time (SUB REFRESH).... very clever... while running your game, tap the upper right corner and select DEBUG... you will notice you are running at 25%.. as you add more code this % will increase... at MAX your game will start to behave irradically ...

Let me help you streamline your code to reduce this % :)


was8bit 2020-03-27 17:36

TIP 1, BG COPY preserves your choice of character as well as choice of palette...

TIP 2, no need to redraw screeen if screen isn't changing, draw it once

TIP 3, erase piece to remove from screen, add pieces as needed...

Check out my version of your game :)

Sandbox 2.nx | Open in app
2020-03-27 17:36

was8bit 2020-03-27 17:37

This runs at 1% capacity, giving you plenty of room to add more code without risking eradic behavior :)


GAMELEGEND 2020-03-27 17:39 (Edited)

I should have know that oh well
Wait i did know that i have no idea why i did not do thst


was8bit 2020-03-27 17:41

Your code runs perfectly :) nothing wrong with your code.. it was in fact very clever :)


was8bit 2020-03-27 17:43

TIP, unless they are GLOBAL, variables inside a SUB do NOT interfer with variables of the same name outside the SUB


GAMELEGEND 2020-03-27 17:43

So very clever just not needed right


was8bit 2020-03-27 17:44

You are set up to make really cool games now, you have the fundamentals :)


GAMELEGEND 2020-03-27 17:44

Perfect


was8bit 2020-03-27 17:45

I have to shuffle off.. catcha later :)


G-9 2020-04-01 11:48

I have an idea ! Check out my old program for up and down scrolling ...


G-9 2020-04-01 11:49

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


GAMELEGEND 2020-04-01 13:54

Thanks


GAMELEGEND 2020-04-01 23:12 (Edited)

is the
REPEAT
UNTIL
Just a do while loop or am i missing something


was8bit 2020-04-01 23:46

NX has 5 ways to create LOOPS...

1)
LABEL1:
--code--
LABEL2:
--code--
IF ... GOTO LABEL1
IF ... GOTO LABEL3
GOTO LABEL2
LABEL3:

Cumbersome, confusing, error prone, but very flexible...

2)
FOR I=1 TO 10
--code--
IF ... THEN I=10
NEXT I

Mostly for sequential handling of things like arrays, can set the index to max to do an early exit out

3)
DO
--code--
IF ... THEN GOTO LABEL1
LOOP

LABEL1:

mostly used for continous running of code until user is finished, great for main control of game or parts of game...

4)
REPEAT
--code--
UNTIL --condition--

Loops until condition is met.. MUST run the code at least once as condition is not checked until the code inside is run first...

5)
WHILE --condition--
--code--
WEND

will ONLY run code IF condition is met.. so it is possible the code won't run at all as condition is checked immediately and wont execute code if condition isnt met...

... THE DIFFERENCE between 4) and 5) is this... use WHILE WEND unless it is absolutely neccessary to do the loop code at least once.... 4) checks conditionals BEFORE running code, REPEAT UNTIL runs code first, THEN checks conditionals


Log in to reply.