Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A 4x4 Field in Pygame
#1
Hello everybody,

I want to make a game in Pygame, where you have a 4x4 squared field and in there are two "cards" (same size as one field) and when you press an arrow key, the cards move in this direction if possible (it shouldn't be possible, when there is no space left in one line).

So my problem is, that I don't know, how to create that field, and making it look, if it is possible to move the card or not.
I've already tried making a field like this:

field = [1,2,3,4,
         5,6,7,8,
         9,10,11,12,
         13,14,15,16]
But now I don't know, how to tell python, that all numbers in the [], should represent a square, and that there can be movable card in them.
Thanks for your help.

Piethon
Reply


Messages In This Thread
A 4x4 Field in Pygame - by Piethon - Aug-11-2019, 04:29 PM
RE: A 4x4 Field in Pygame - by metulburr - Aug-11-2019, 10:06 PM
RE: A 4x4 Field in Pygame - by SheeppOSU - Aug-12-2019, 08:15 PM
RE: A 4x4 Field in Pygame - by Piethon - Aug-13-2019, 09:28 AM
RE: A 4x4 Field in Pygame - by Windspar - Aug-13-2019, 10:38 AM
RE: A 4x4 Field in Pygame - by Piethon - Aug-14-2019, 07:44 AM
RE: A 4x4 Field in Pygame - by Windspar - Aug-14-2019, 12:24 PM
RE: A 4x4 Field in Pygame - by Piethon - Aug-18-2019, 09:50 AM
RE: A 4x4 Field in Pygame - by Piethon - Aug-19-2019, 10:08 AM
RE: A 4x4 Field in Pygame - by Windspar - Aug-18-2019, 11:26 AM
RE: A 4x4 Field in Pygame - by metulburr - Aug-18-2019, 12:23 PM
RE: A 4x4 Field in Pygame - by metulburr - Aug-19-2019, 11:33 AM
RE: A 4x4 Field in Pygame - by Windspar - Aug-19-2019, 11:38 AM
RE: A 4x4 Field in Pygame - by Piethon - Aug-19-2019, 12:09 PM
RE: A 4x4 Field in Pygame - by metulburr - Aug-19-2019, 01:07 PM
RE: A 4x4 Field in Pygame - by Windspar - Aug-19-2019, 04:37 PM
RE: A 4x4 Field in Pygame - by Piethon - Aug-19-2019, 06:49 PM
RE: A 4x4 Field in Pygame - by Windspar - Aug-19-2019, 09:21 PM
RE: A 4x4 Field in Pygame - by metulburr - Aug-19-2019, 10:49 PM
RE: A 4x4 Field in Pygame - by Piethon - Aug-20-2019, 08:51 AM
RE: A 4x4 Field in Pygame - by Windspar - Aug-20-2019, 10:38 AM
RE: A 4x4 Field in Pygame - by metulburr - Aug-20-2019, 12:03 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020