Questions tagged [blit]

BLock Image Transfer - Involves copying one bitmap onto another using a raster operator.

303 questions
1
vote
0 answers

Blitting with a camera leads to seams (due to floating point errors?)

I'm working on a tilemap implementation with blitting (in Flash but I don't think it's language relevant). The problem I'm having is that as I pan my camera around, 1 pixel seams start to become visible depending on the location. Here's how I…
1
vote
1 answer

How to make text-rects appear one after another, after a delay in pygame

hoping to get some help regarding blitting text-rects in a sequence, a small delay of about a second between them. I've managed to get pretty close however my most recent attempt repeats the process of blitting my three lines of text over and over.…
JoelGR
  • 25
  • 4
1
vote
1 answer

pygame display becomes unresponsive when clicking outside of the display

I am very new to using the pygame library, and graphics in general. I have a recursive function that is solving a sudoku puzzle by means of backtracking. I'm trying to use pygame to visualize this process. Each time the recursive function tries a…
NewBoard
  • 180
  • 1
  • 9
1
vote
1 answer

Previous screen is not clearing in pygame

Here I'm trying move which is blotted on the screen but the image moving without clearing the previous one balloon=pygame.image.load("BALLON 1".png) Bal_x=0 while true: for event in pygame.event.get(): if…
raju
  • 23
  • 1
  • 1
  • 8
1
vote
1 answer

Pygame animation doesnt work for the left movements, only right movements work

I have this pygame program where I animate the character's movement, everytime i press A or D, the x coordinate changes and the character blits an image of itself moving. The right movement, jump and standing animations work, but not the left…
1
vote
1 answer

Pygame: font.render() gives "TypeError: Invalid foreground RGBA argument"

I tried to make a total clicks bar with screen.blit() (also i want it to update the text when you click), I tried text = font.render('Your total clicks are',totalbal, True, WHITE) but it doesn't work line 21, in text =…
Zgn
  • 132
  • 7
1
vote
4 answers

BitmapData.rect creates a new rectangle?

I was working on some blitting code today and after profiling it found that I was creating 1000s of new rectangles. I was shocked because I only had 1 or 2 different new Rectangle() calls or I was using the .rect property of BitmapData. I started…
1
vote
1 answer

How to show text when true

I want to show a text on the screen when a variable changes to True. The Text "Game Over" is show for a very short period of time with this code but I disappears after less than one second. import pygame import random import time import math #…
Doritito
  • 77
  • 7
1
vote
1 answer

Pygame rotozoom rescaling the image out of bounds

I want to display an image of a star that grows bigger by 1% every second. I use the pygame.transform.rotozoom function to do so. When using rotozoom, the star indeed grows bigger, but its drawing rectangle doesn't grow enough, making the star…
Zene0
  • 25
  • 3
1
vote
1 answer

Pygame surface resize

When I make window resize, surfaces boundaries not resizing as window do. Text render at main surface in starting window boundaries (600x340). Why? Also a render images (I cut this code part to simplify problem) as background and it render normally…
RedSubmarine
  • 177
  • 4
  • 16
1
vote
1 answer

How to make an imported module blit onto a surface from the main script?

In my main file I have a surface called win. I import a module like so from draw import *. def draw(image,x,y): win.blit(image,(x,y)) This is a function from draw. It doesn't work because win is not defined. How to make it defined?
bad_coder
  • 73
  • 1
  • 6
1
vote
1 answer

how to clear text on a window in pygame

In my game That I am making. I am trying to resolve this problem that I Have with the game over screen. the problem is when you die it says 'You died' then I put 'Play again' or 'Quit'. If you press Quit Obviously it quits the game but if you press…
Zina
  • 159
  • 8
1
vote
2 answers

Why won't my title screen play button launch my game?

I am trying to put a play button in my game. and when I launch the game I click the play button and it gives me an error Traceback (most recent call last): File "C:\Users\Zee_S\OneDrive\Desktop\python projects\lil Shooter\Player\Lil Shooter.py",…
Zina
  • 159
  • 8
1
vote
1 answer

Why do I get an error when I blit an image

I'm Trying to put an enemy into a game That I am making. but when I run the project the python reports a 'TypeError' File "C:\Users\Zee_S\OneDrive\Desktop\python projects\lil Shooter\Player\Lil Shooter.py", line 153, in draw …
Zina
  • 159
  • 8
1
vote
2 answers

How to make a rectangular object to move slowly across the screen?

i am new to python programming and now starting to write simple "Snake" game. i am trying to make the head of the snake move around the screen in a way that when an arrow key is pressed, the head should move in that direction non-stop, until a…
levi
  • 43
  • 1
  • 6