I'm having trouble figuring out how to implement where boundaries are (platforms/landings/ceilings).

I have an image running across a background image. When the image gets 3/4 of the way to the canvas, it stops moving and the background image scrolls. Same things going backward at 1/4. So with two different x values (character centered x value, and background centered x value) I'm trying to figure out how to create boundaries....

I've heard pygame makes this easier, but I may or may not have time to learn pygame properly since this is for an assignment due soon and I have a lot of work to go. If I can keep my tkinter code and implement pygame as well, that would be great, otherwise, I'd like tkinter based help.

Thanks!

Looks OK for me.

? Maybe I didn not phrase my question well. I do not have a problem with scrolling through the image with the character.

Simply put, I need to make it so the front image (character) cannot go on top of certain parts of the background (preferrably I would like to have a function that checks if the movement is legal, and only allows it if it is). Since I scroll the image through the canvas at times (image is longer than canvas) the coordinates for these parts do not remain constant as the background image is centered to a different location to provide the scrolling effect.

It is not constant, but can't you use variables? Post relevant, running part of your code (with the images attached) and what error you are getting, what you wanted instead, what you tried to do to fix it until now.

Edited 5 Years Ago by pyTony: n/a

It is not constant, but can't you use variables? Post relevant, running part of your code (with the images attached) and what error you are getting, what you wanted instead, what you tried to do to fix it until now.

Kind of can't, we cannot post our code to the internet.

Let's say I have canvas.data.manPosX for characters position x within canvas.
Also, canvas.data.scrollX, equaling where the image is centered on the canvas (default is 500 at beginning before scrolling begins)

How would I go about making so that whenever canvas.data.manPosX is equal to a certain x value on the image (which changes when scrolled) I call a function I want. I guess what i'm asking for, what variable should I be creating, because for some reason i don't see a solution even though it seems simple enough.

Further explanation. The point is at canvas.data.manX = 360 and canvas.data.scrollX = 1260. However, when the image scrolls due to the character running "through" the image, manX can be at that point with a value 540 and scrollX value of 1500.

Kind of can't, we cannot post our code to the internet.

Let's say I have canvas.data.manPosX for characters position x within canvas.
Also, canvas.data.scrollX, equaling where the image is centered on the canvas (default is 500 at beginning before scrolling begins)

How would I go about making so that whenever canvas.data.manPosX is equal to a certain x value on the image (which changes when scrolled) I call a function I want. I guess what i'm asking for, what variable should I be creating, because for some reason i don't see a solution even though it seems simple enough.

Further explanation. The point is at canvas.data.manX = 360 and canvas.data.scrollX = 1260. However, when the image scrolls due to the character running "through" the image, manX can be at that point with a value 540 and scrollX value of 1500.

Nvm, I got it. (manx - (scrollx - default)) was what I was looking for.

This question has already been answered. Start a new discussion instead.