Page 2 of 7

Re: Snake Game Tutorial 14a

Posted: January 13th, 2017, 6:07 am
by Blood
Hey I'm curious as to how you managed to crop the exact shapes of the dude and poo objects to use in the code. Is there any program you can recommend? I've been trying to figure it out using Gimp.

Re: Snake Game Tutorial 14a

Posted: January 13th, 2017, 6:23 am
by chili
Crop the exact shapes? The tool that turns bmp -> putpixel code just treats one of the colors as transparent and doesn't generate putpixel code for pixels of that color.

Re: Snake Game Tutorial 14a

Posted: January 14th, 2017, 6:56 pm
by Blood
I'm curious as to what you use to crop the exact image of the dude and poo objects. Do you think you can let me know? I'd appreciate it. Thanks again(:

Re: Snake Game Tutorial 14a

Posted: January 14th, 2017, 10:39 pm
by albinopapa
Chili's BMP to PutPixel call program
http://www.planetchili.net/forum/download/file.php?id=5

Lux's Image to PutPixel call program
http://www.planetchili.net/forum/downlo ... php?id=148

Re: Snake Game Tutorial 14a

Posted: January 15th, 2017, 11:47 pm
by Blood
Ah, thanks. Sorry, I didn't realize i posted that twice. I'll try it out (:

Re: Snake Game Tutorial 14a

Posted: January 18th, 2017, 6:56 am
by Blood
I understand the first portion of the tutorial, where you have to create the board class and all,
but when you start mentioning delta_loc and create all those other functions, I'm lost again around 23:00

Sorry if that's not very specific, I'm just lost at that exact point and everything after that doesn't make sense to me. It's a bit difficult to understand the logic and what's going on.

Re: Snake Game Tutorial 14a

Posted: January 19th, 2017, 8:39 am
by chili
Blood wrote:I understand the first portion of the tutorial, where you have to create the board class and all,
but when you start mentioning delta_loc and create all those other functions, I'm lost again around 23:00

Sorry if that's not very specific, I'm just lost at that exact point and everything after that doesn't make sense to me. It's a bit difficult to understand the logic and what's going on.
Hmmm, well let's break it down then.

First, do you understand the idea of combining the grid coordinates (x,y) into a single data type (struct Location) and storing and using them as a single unit thereby?

Re: Snake Game Tutorial 14a

Posted: January 19th, 2017, 10:39 am
by Blood
Yeah, I believe so.

It's basically just using different functions to generate the individual pixels to form the rectangles, where the values of loc.x and loc.y would use some algorithmns to be translated into the start coordinates of where the rectangles should be drawn on the screen, and the dimensions are used to determine when the rectangles should stop drawing. We combine them by iterating over a loop which initializes a location object, passing the new values of x and y to the constructor , thereby allowing us to simply pass in the location object as opposed to passing in x and y all the time.

Correct me if I'm wrong? :D Thank you for helping

Re: Snake Game Tutorial 14a

Posted: January 20th, 2017, 3:29 am
by chili
Alright, I see one issue to start with. It is not fruitful to think about Location data in terms of rectangles or pixels. Location has nothing to do with these things. Location represent the grid position in game space, in the pure world of our simulation, and is not tied to any particular graphical representation. The graphical aspect is handled by the Board class, which takes grid coordinates (Locations) and translates them into rectangles formed of pixels.

For example, I could port the Snek game so that it would be played in a text terminal, rather than in a window client region rendered with Direct3D. In that case, the ideas of rectangles and pixels would not apply, but he ideas of Location--ideas about the grid coordinates in the simulation world--would not be affected at all. I need only change the Board class, and I can have the same game run the exact same way, but this time in a console.

Does this make sense? Also, do you still need help with delta_loc concepts?

Re: Snake Game Tutorial 14a

Posted: January 21st, 2017, 3:26 am
by Blood
Thanks for that explanation (:
And yeah, I'm still a bit confused on how the movement of the segments occur.
You stated that they need to follow the proceeding segment in order, starting from the tail.