Topic:   Platforming and Collision Code   (Read 10396 times)


0 Members and 1 Guest are viewing this topic.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Platforming and Collision Code
« Reply #30 on: September 07, 2012, 10:03:28 PM »
Guys I think I can add scrolling without a total rewrite of the sprite code for the game! I'll keep you posted.
EDIT: There are so many problems with this idea that I don't really wanna mess with it tonight.
« Last Edit: September 07, 2012, 10:15:22 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Platforming and Collision Code
« Reply #31 on: September 07, 2012, 11:23:45 PM »
Usually adding scrolling only requires changing your drawing code to have a moveable "camera" that can follow the player.

Zoo


  • GMG Extraordinaire

  • ***


  • Posts: 1686
    • My Bandcamp
Re: Platforming and Collision Code
« Reply #32 on: September 08, 2012, 11:43:37 AM »
Scrolling'd be cool.
Kirby, your pudgy buddy from dream land, is back again on the game boy®!

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Platforming and Collision Code
« Reply #33 on: September 08, 2012, 04:45:31 PM »
I kept the original code, which is fine, yet when I set "LET scroll = true" the map moves and the player acts as if his xpos variable is static.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Platforming and Collision Code
« Reply #34 on: September 08, 2012, 05:22:03 PM »
Fixed it for ya.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Platforming and Collision Code
« Reply #35 on: September 08, 2012, 05:44:32 PM »
Alright, this is fantastic! Now I can make big ol' levels where you have to make wall jumps and change direction in mid-air other such physics-defying nonsense.

May I ask what you did, and how I can constrain scrolling to the x or y axis if I want?
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Platforming and Collision Code
« Reply #36 on: September 08, 2012, 05:54:35 PM »
Your code was right on for the most part.
I just made two variables:
Code: [Select]
LET cameraX = xpos(player) - 500
LET cameraY = ypos(player) - 300
MOVESPRITE object, x - cameraX, y - cameraY

This is the magic code that makes the universe revolve around the player. You can constrain with if statements:
Code: [Select]
IF cameraX > 500 THEN cameraX = 500

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Platforming and Collision Code
« Reply #37 on: September 08, 2012, 06:00:11 PM »
Right. Great. And I can easily turn it on and off!

Now I need to remake the variable size editor. I could have sworn I already did this once before, though...
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/