Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Sonic physics
- Blaze349
-
1000+ posts
Sonic physics
I making a sonic game with sonic physics but have no idea how to do it. I am trying to make it tile based but are so confused with this(https://info.sonicretro.org/SPG:Solid_Tiles) I've messed up my project.
- ECLIPSE-STUDIOS
-
100+ posts
Sonic physics
Hi,
I would recommend using a scrolling platformer as the base, as you can see here: http://wiki.scratch.mit.edu/wiki/Scrolling_Platformer_Tutorial
Sticking with the tiles aspect, however, I would create a list with the values of ScrollX that are each tiles start and end point. This would mean you could create tiles less that the width of the screen, and program holes to fall through. In this case, if you then created another list, with 1 entry for every scrollx up until the edge of the level (so there'd be HUNDREDS of values), and you could take the first value from the first list and keep and “TILE” to the second list until the item number is the second item in the first list, then add “OFF” to the list until it reached the item number of item 3 of the original list. E.G.
TileDimensions
#1 1
#2 480
#3 481
#4 500
#5 505
#6 510
TileData
#1 TILE
#2 TILE
…
#480 TILE
#481 TILE
…
#500 TILE
#501 NO
#502 NO
…
#505 TILE
…
#510 TILE
#511 NO
And so one. You could then use
Then keeping with the 2 sensor idea, one sensor is 5 MORE than 0 - ScollX, and one is 5 LESS.
If you have any more questions feel free to ask!
Hope this helps!
I would recommend using a scrolling platformer as the base, as you can see here: http://wiki.scratch.mit.edu/wiki/Scrolling_Platformer_Tutorial
Sticking with the tiles aspect, however, I would create a list with the values of ScrollX that are each tiles start and end point. This would mean you could create tiles less that the width of the screen, and program holes to fall through. In this case, if you then created another list, with 1 entry for every scrollx up until the edge of the level (so there'd be HUNDREDS of values), and you could take the first value from the first list and keep and “TILE” to the second list until the item number is the second item in the first list, then add “OFF” to the list until it reached the item number of item 3 of the original list. E.G.
TileDimensions
#1 1
#2 480
#3 481
#4 500
#5 505
#6 510
TileData
#1 TILE
#2 TILE
…
#480 TILE
#481 TILE
…
#500 TILE
#501 NO
#502 NO
…
#505 TILE
…
#510 TILE
#511 NO
And so one. You could then use
to work out which value of the 2nd llist the player should be looking at.
Then keeping with the 2 sensor idea, one sensor is 5 MORE than 0 - ScollX, and one is 5 LESS.
If you have any more questions feel free to ask!
Hope this helps!
Last edited by ECLIPSE-STUDIOS (Nov. 29, 2015 14:08:36)
- Blaze349
-
1000+ posts
Sonic physics
So basically the same as the scroller Hi,
I would recommend using a scrolling platformer as the base, as you can see here: http://wiki.scratch.mit.edu/wiki/Scrolling_Platformer_Tutorial
Sticking with the tiles aspect, however, I would create a list with the values of ScrollX that are each tiles start and end point. This would mean you could create tiles less that the width of the screen, and program holes to fall through. In this case, if you then created another list, with 1 entry for every scrollx up until the edge of the level (so there'd be HUNDREDS of values), and you could take the first value from the first list and keep and “TILE” to the second list until the item number is the second item in the first list, then add “OFF” to the list until it reached the item number of item 3 of the original list. E.G.
TileDimensions
#1 1
#2 480
#3 481
#4 500
#5 505
#6 510
TileData
#1 TILE
#2 TILE
…
#480 TILE
#481 TILE
…
#500 TILE
#501 NO
#502 NO
…
#505 TILE
…
#510 TILE
#511 NO
And so one. You could then useto work out which value of the 2nd llist the player should be looking at.
Then keeping with the 2 sensor idea, one sensor is 5 MORE than 0 - ScollX, and one is 5 LESS.
If you have any more questions feel free to ask!
Hope this helps!
- SpaceCookie2017
-
8 posts
Sonic physics
So I want to make a Sonic game and can you please help me apply the information from <http://info.sonicretro.org/SPG:Solid_Tiles> and the code I need to program. I'm not an experienced coder and I need help, please!
- SpaceCookie2017
-
8 posts
Sonic physics
Blaze349 or anyone reading this feed, can you please make a detailed script of what it would look like if I program the tiles? Please make sure you have an experienced or intermediate knowledge of coding.
Last edited by SpaceCookie2017 (Nov. 6, 2019 00:30:39)
- AylUser351
-
1 post
Sonic physics
I think that maybe you can detect how much speed you have on a ramp/slope and when you leave the slope youll get flinged a little but how do you detect if its going downhill?
- Discussion Forums
- » Help with Scripts
-
» Sonic physics