Re: Help with map creation please?

@3
OK, putting your first paragraph int code speak, when your player walks off the block, what I think they're actually doing, is stepping into a space where there is no block. At this point, they should "fall" down the z axis until they hit the next block down.

Feel free to pinch Earwax's Poing class, and use that, since it's got all the operator overloading you could need, but if for some reason that isn't feasible, the basic class is:

class Point
    """A point in 3d space."""

    x: int
    y: int
    z: int

    def __init__(self, x: int, y: int, z: int) -> None:
        self.x = x
        self.y = y
        self.z = z

Then you could have:

from typing import Any, List


class Tile:
    """A tile on the map."""

    name: str
    start: Point
    end: Point
    data: Any

    def __init__(self, data: Any, start_x: int, start_y: int, start_z: int, end_x: int, end_y: int, end_z: int, name: str = 'Untitled block') -> None:
        self.start = Point(start_x, start_y, start_z)
        end = Point(end_x, end_y, end_z)
        self.data = ""
        self.name = name


class Map:
    """A map which holds a load of tiles."""

    name: str
    tiles: List[Tile]

    def __init__(self, name: str = 'Untitled Map') -> None:
        self.name = name
        self.tiles = []

When you say you want to create a map of blocks, do you mean randomly-generated ones? Or are you hand coding your map yourself? If the first, then that's easy, you just create it whenever you like. If you want random, then that's a little more subjective, because you're essentially talking about randomly-generated terrain, which isn't something I know a whole bunch of stuff about yet.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lemm via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : nolan via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector

Reply via email to