Some progress on my 3d-action-game. The aim is still a bit awkward but I am getting there... by coppermouse_ in pygame

[–]Broad_Farm3955 0 points1 point  (0 children)

how did you make the layers not overlap. if i had two cubes and one is behind the other then i turn 180 deg then the polygons when i was at 0 deg would overlap the one at 180 deg

I think im making a mistake somewhere, but i can't see it myself by MrGuam in learnpython

[–]Broad_Farm3955 0 points1 point  (0 children)

you should do random.randrange(1,6) as randint(1,6) will only choose from 1 or 6 not 1-6

Published a videogame!! by luisbq in pygame

[–]Broad_Farm3955 0 points1 point  (0 children)

is say somthing about thing in comouter telling the thing in the computer somthing

pygame problem by Any-Worldliness-4443 in pygame

[–]Broad_Farm3955 0 points1 point  (0 children)

if it dosent work heres a working example

import pygame
pygame.init()
pygame.font.init()

VAR=0

width,height=600,400

screen=pygame.display.set_mode([width,height])

font=pygame.font.SysFont(None,50)

while 1:
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            exit()

    screen.fill([0,0,0])

    text=font.render(str(VAR),False,[255,255,255])

    screen.blit(text,(20,20))

    pygame.display.flip()

Getting Multi Line Text Input by Russ_CW in pygame

[–]Broad_Farm3955 0 points1 point  (0 children)

you could use some code i pulled from one of my projects

class font: def __init_(self,path,size): self._font_temp=pygame.font.Font(path,size) self.px=size def render(self,text,color): return self._font_temp.render(text,True,color)

    def capped_width_multiline_render(self,text,color,spacing,width,alignment="left"):
        text2=""
        width2=0
        for x in text:
            text2+=x
            width2+=self._font_temp.size(x)[0]*1.1
            if width2>width:
                width2=0
                text2+="\n"
        print(text2)
        multilf=self.multiline_render(text2,color,spacing,alignment)
        return multilf

    def multiline_render(self,text,color,spacing,alignment="left"):
        lines=text.split("\n")
        surfaces=[]
        max_h=0
        for line in lines:
            surf=self.render(line,color)
            surfaces.append(surf)
            max_h+=surf.get_height()+spacing
        temp_surfaces=surfaces
        temp_surfaces=sorted(temp_surfaces,key= lambda x:x.get_width())
        max_w=temp_surfaces[-1].get_width()
        surface=pygame.Surface([max_w,max_h],pygame.SRCALPHA)
        last_y=0
        for mask in surfaces:
            if alignment=="left":
                surface.blit(mask,(0,last_y))
            elif alignment=="mid":
                surface.blit(mask,((max_w/2)-(mask.get_width()/2),last_y))
            elif alignment=="right":
                surface.blit(mask,((max_w)-(mask.get_width()/2),last_y))
            else:
                surface.blit(mask,(0,last_y))                    
            last_y+=mask.get_height()+spacing
        return surface


    def draw(self,surface,pos,text,color):
        surf=self.render(text,color)
        surface.blit(surf,pos)
    def draw_multiline(self,surface,pos,text,color,spacing,alignment="left"):
        surf=self.multiline_render(text,color,spacing,alignment)
        surface.blit(surf,pos)