Jump to content

Hello everyone, i've been tying to find out how to make scrolling in pygame for a while now. I asked on stack overflow and my question got downvoted a ton because they said, they can answer questions like that or something. 

 

so what i want to know is how to make my game scroll like this http://i.imgur.com/zTaBiQi.gif

 

and i am wondering if i get it to scroll like in pokemon how do i make the map so big that you can walk everywhere like what size to i make it

my screen is going to be 800x600.

 

the game im looking to make will be the same as zelda a link to the past on GBA just with my own story.

 

if you dont know what im asking by anything feel free to tell me and ill try to describe it as best as i can.

 

 

Link to comment
https://linustechtips.com/topic/468369-how-to-make-scrolling-in-python-game/
Share on other sites

Link to post
Share on other sites

make it so that instead of having your character moving you have the on screen objects move in the opposite direction

and if they are out of bounds of the screen then hide them

and if new objects enter the bounds then show

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

well not i have a problem of its own for from reason my player image wont show up on the screen. can anyone tell me why?

import pygamepygame.init()screen = pygame.display.set_mode((800,600))pygame.display.set_caption("hi")black = (0,0,0)white = (255,255,255)red = (200,0,0)green = (0,200,0)blue = (0,0,255)bright_red = (255,0,0)bright_green = (0,255,0)gray = (153,153,153)x,y = 0,0moveX, moveY = 0,0Player = pygame.image.load('C:/Python34/main game project/player.png')clock = pygame.time.Clock()gameLoop=Truewhile gameLoop:    for event in pygame.event.get():        if (event.type == pygame.QUIT):            gameLoop = False        if (event.type == pygame.KEYDOWN):            if (event.key == pygame.K_a):                moveX = -5            if (event.key == pygame.K_d):                moveX = 5            if (event.key == pygame.K_w):                moveY = -5            if (event.key == pygame.K_s):                moveY = 5        if (event.type == pygame.KEYUP):            if (event.key == pygame.K_a):                moveX = 0            if (event.key == pygame.K_d):                moveX = 0            if (event.key == pygame.K_w):                moveY = 0            if (event.key == pygame.K_s):                moveY = 0    screen.fill(white)    Player.blit(screen,(x,y,50,50))    x += moveX    y += moveY        clock.tick(50)    pygame.display.update()pygame.quit()
Link to post
Share on other sites

make it so that instead of having your character moving you have the on screen objects move in the opposite direction

and if they are out of bounds of the screen then hide them

and if new objects enter the bounds then show

i am hoping for people to post links to stuff or explain it , i am fairly new to coding.

Link to post
Share on other sites

If your fairly new to coding just stop trying to make games and learn how to program first as game development isn't trivial. Once you have a solid understanding of programming as a whole as well as understanding of the language you will be using then go ahead and make a game.

Also you question is very broad thats probably why it got downvoted.

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to post
Share on other sites

If your fairly new to coding just stop trying to make games and learn how to program first as game development isn't trivial. Once you have a solid understanding of programming as a whole as well as understanding of the language you will be using then go ahead and make a game.

Also you question is very broad thats probably why it got downvoted.

i should of rephrased that im new to pygame i've knowed python for about 2 months now, and im new to making games with it ive made like calculators and stuff before.

 

and its not broad i said what i wanted to know and provided an example, i dont get how asking for links to tutorials of how to make a map scroll with the player is broad. 

Link to post
Share on other sites

i should of rephrased that im new to pygame i've knowed python for about 2 months now, and im new to making games with it ive made like calculators and stuff before.

 

and its not broad i said what i wanted to know and provided an example, i dont get how asking for links to tutorials of how to make a map scroll with the player is broad. 

 

2 months is nothing. I've been programming for about 6 years now including a year doing it as a job and not just in my degree and I wouldn't dream of touching game development yet.

 

The question is too broad because there are too many factors to consider. There aren't "tutorials" of how to make a map scroll because if you understood the detail behind graphics programming enough then you'd realise it's just rendering the world below the camera and moving the camera left and right. Your code snippet is trivial, what you're implying you want to implement in your OP is orders of magnitude more complicated than any calculator you've made before. Dream big sure but this is like a caveman inventing the wheel and then trying to fly to the moon.

Link to post
Share on other sites

2 months is nothing. I've been programming for about 6 years now including a year doing it as a job and not just in my degree and I wouldn't dream of touching game development yet.

 

The question is too broad because there are too many factors to consider. There aren't "tutorials" of how to make a map scroll because if you understood the detail behind graphics programming enough then you'd realise it's just rendering the world below the camera and moving the camera left and right. Your code snippet is trivial, what you're implying you want to implement in your OP is orders of magnitude more complicated than any calculator you've made before. Dream big sure but this is like a caveman inventing the wheel and then trying to fly to the moon.

yeah i decided just to buy rpg maker vx ace

Link to post
Share on other sites

make it so that instead of having your character moving you have the on screen objects move in the opposite direction

and if they are out of bounds of the screen then hide them

and if new objects enter the bounds then show

Or he could implement a camera object that's locked to the player's position.

 

Also, @GammaProX , why python?

Sure , you can make a game with pygame, but...why?

And yet again, making your own game engine is hard and takes a lot of time and research. Sure, it's a heck of an experience , but if you just want to make a game, then simply use Unity. It will still challenge your programming skills due to scripting.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to post
Share on other sites

Or he could implement a camera object that's locked to the player's position.

 

Also, @GammaProX , why python?

Sure , you can make a game with pygame, but...why?

And yet again, making your own game engine is hard and takes a lot of time and research. Sure, it's a heck of an experience , but if you just want to make a game, then simply use Unity. It will still challenge your programming skills due to scripting.

python is the only language i know so i wanted to start with that

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×