Seba06 2018-11-19 19:03
Ok, I couldn’t find an appropriate way to make the title so it’s not really what the title says but still pls answer me. How can I tell the program to detect if there is a certain character in the background as a cell and turn it into a sprite. I already know how I can turn a cell into sprite but I first need the program to check if a certain character is in the screen and if it is return the x and y location of that cell.
@Was8bit I already know you are smashing you keyboard ;)
was8bit 2018-11-20 04:00
FOR IY=0 TO 19
FOR IX=0 TO 15
IF C=CFIND THEN
Timo 2018-11-20 07:36
For the x and y position: A cell is always 8x8 pixels, so you can just multiply. If the cell is at column 4 and row 6, then the pixel position is: 4*8,6*8 -> 32,48
was8bit 2018-11-20 10:21
Initially that was confusing for me, in regular lowres, TEXT always used pixel location, where in LowRes NX text uses Cell location
for NX, SPRITES use pixel location, as does TOUCH, but I believe everything else uses CELL location..
Another tricky thing I had to learn was that a CELL coordinate is located at its top left point, so CELL 1,1 coordinate is in pixels 8,8 which physicslly is its top left point.. the same is true for SPRITES...
So when handling issues like checking if a SPRITE has touched the edge of a CELL, there is no automatic command like for sprites hitting sprites.. so it's trickier.. it takes testing an tweaking the math until you like the results..
Too bad there isn't a command that detects if a Sprite has hit a background character, would make it a lot easier :)
Seba06 2018-11-20 10:25
was8bit 2018-11-20 10:58
Your idea sounds interesting, can't wait to see what you're up to :)
Seba06 2018-11-20 13:21
The reason I asked is to make it easier to add objects to the geometry dash game such as spikes and stuff because if they are already sprites all I have to do is check if they collide with the player.
was8bit 2018-11-20 15:17
Oh, well if your player is the Sprite, then it's easier to use the sprites x,y to see what's underneath the Sprite... check out my pinball game..
If SX,SY is the sprites coordinates, then C=CELL.C(SX\8,SY\8) is the character underneath the Sprite....
Detecting collisions with characters can be tricky though. Sometimes you need to tweak the math.. adding 0.5 to the sprites coordinates is a compromise , or check my pinball for a more accurate approach...
Seba06 2018-11-20 18:27
Ok so here’s the story: after I added the spikes and stuff I noticed that any spike or bounce pad that was placed in the first “frame” didn’t turn into a sprite in the first time the bg looped. This was because it converts the cell into sprite every time a new column of cells entered the screen. I could either just not put any traps on the first “frame” or fix it. I tried. It bug. Please help. Help.
was8bit 2018-11-21 05:33
It would make more sense to either make the spikes character only or Sprite only...
Look at my gamemaker... the only Sprite is the player, but the player interacts differently to different characters it comes in contact with....
Seba06 2018-11-21 10:39
Yea but in your game maker he is constantly moving by cells. In geometry dash the movement is more smoother and it’s by pixels with in means that whenever checking for a collision the cells are offset to their actual position so using cell.c is harder. Also sometimes the player can be in a position where just using CELL.C(1,Y\8+1) is not going to see the block so you’ll also have to try CELL.C(2,Y\8+1) and it’s evem harder to check if they are one on top of the other as there can be so many positions where the program won’t detect the cell.
was8bit 2018-11-21 12:22
Well, the smoothing out part WILL be added later... the trick i am going to use is to ONLY allow movement from cell to cell...., work out all those kinks, and then later animate a smoother transition cell to cell..
In my pinball game, I DO use pure random movement, but there I compromised on reaility by restricting the environment
I also use pure random movement in my tank game, but there the compromise was to use stationary sprites for the inner walls which made pure movements possible .. and even then I had to compromise on the corners...
It IS possible to create pure movements, but would require pixel precison calculations of all possible contact points of player to all possible contact points of object and track movement of player and movement of target and create a logic of the results..
Im very sure the original super mario used some sort of tricks to simplify this task... my gamker uses Pacman's tricks, I'll do some research to see what tricks mario uses :)
Seba06 2018-11-21 12:32
The thing is that because of that pixel movement it’s easier to just turn some of the cells into sprites which is why I’m doing wha I’m doing instead of making it like your game maker. Even if you add a transition from cell to cell it’s still moving from cell to cell and mine is by pixels which is why I can just make it check if there is a character in the background so I prefer to turn them into sprites. I think that with the bug I might just not put any traps on the first frame of each level.
was8bit 2018-11-21 12:34
If you have the patience, this is THE actual super mario code...
It's a huge read...
was8bit 2018-11-21 12:35
This is the one I'm currently reading :)
Seba06 2018-11-21 12:36
I don’t know what super Mario was written in..
Seba06 2018-11-21 12:37
Also I don’t want to copy someone else’s code I want to figure out how to do this by myself and maybe sometimes ask for help
was8bit 2018-11-21 12:55
I research, why reinvent the wheel :)
Another site I'm reading :)