<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Draculinio</title>
    <description>The latest articles on DEV Community by Draculinio (@pablosoifer1).</description>
    <link>https://dev.to/pablosoifer1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1118999%2F746ad967-22a7-45ea-a731-50bfc92541ac.jpg</url>
      <title>DEV Community: Draculinio</title>
      <link>https://dev.to/pablosoifer1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pablosoifer1"/>
    <language>en</language>
    <item>
      <title>Making a Roguelike while chillin out part III</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Tue, 30 Jul 2024 18:48:37 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/making-a-roguelike-while-chillin-out-part-iii-15m9</link>
      <guid>https://dev.to/pablosoifer1/making-a-roguelike-while-chillin-out-part-iii-15m9</guid>
      <description>&lt;p&gt;Last night, all sleepy I made the third session of my "Chill &amp;amp; Python" live in youtube.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/live/yAHTIwv8cr8?feature=share" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--wfMv-L7k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.ytimg.com/vi/yAHTIwv8cr8/maxresdefault.jpg" height="450" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/live/yAHTIwv8cr8?feature=share" rel="noopener noreferrer" class="c-link"&gt;
          Chill out and #python sesión III - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Un poco de #pythonprogramming y música relajante para acompañarte. Ni microfonos ni camaras. Solo musica y codigo al azar. Te acompa;o un par de horas.Cada t...
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--P9FN5sTf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.youtube.com/s/desktop/103479f3/img/favicon.ico" width="16" height="16"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;It is a space where I just chill out, put some music and code without any pressure or stress, just for the sake of it.&lt;/p&gt;

&lt;p&gt;While doing this I decided to make a roguelike game that works on any console.&lt;/p&gt;

&lt;p&gt;What is new since last time? I changed who is responsable for what. Sometimes is difficult to establish responsabilities between classes.&lt;/p&gt;

&lt;p&gt;Now, the room class does not have enemies, but positions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random

class Room:
    def __init__(self, name, description, enemies) -&amp;gt; None:
        self.name = name
        self.description = description
        self.room_arch = [[0]*78 for _ in range(21)]
        self.room_architecture()

    def describe_room(self):        
        return {'name':self.name, 'description': self.description}

    def room_architecture(self):
        for i in range(0,21):
            for j in range(0,78): #Hardcoded values, for now it will be ok...
                self.room_arch[i][j]= random.randint(0,1) #for now, 2 values will be ok. 0 = empty, 1 = wall
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the first step on creating dungeons, the most simply way to put stuff in the "room". Just random 0 and 1. If 0, then put an empty space, if 1, put a wall in the form of a #.&lt;/p&gt;

&lt;p&gt;Now, enemies are not part of the room, enemies are enemies and we will see  some day how to make that work, but for now, I can create an enemy in the principal file and give it a position in x and y. I also have a symbol and a code to send it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random

class Enemies:
    def __init__(self, name, strength, defense, life, posx,posy,symbol): 
        self.name = name
        self.strenght = strength
        self.defense = defense
        self.posx = posx
        self.posy = posy
        self.life = life
        self.symbol = symbol

    def initial_place(self, room):
        found = False
        while not found:
            self.posx = random.randint(0,77)
            self.posy = random.randint(0,21)
            if room.room_arch[self.posy][self.posx] in [0]:
                found = True

    #TODO: the enemies should move every turn.
    def move_enemy(self, room):
        move = random.randint(1,4)
        if move == 1: 
            if self.posx&amp;gt;1 and room.room_arch[self.posy][self.posx-1] in [0]:
                self.posx -=1
        if move == 2:
            if self.posx&amp;gt;1 and room.room_arch[self.posy][self.posx+1] in [0]:
                self.posx +=1
        if move == 3:
            if self.posx&amp;gt;1 and room.room_arch[self.posy-1][self.posx] in [0]:
                self.posy -=1
        if move == 4:
            if self.posx&amp;gt;1 and room.room_arch[self.posy+1][self.posx] in [0]:
                self.posy+=1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, not only the position but the movement is part of the enemy now. With that it is easier to manage all what happens in the game. Responsabilities are better now.&lt;/p&gt;

&lt;p&gt;This is something terrible but is just basecode...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; room.room_arch[enemy.posy][enemy.posx] = 0 #THE MOST HARDCODED THING ON EARTH
        enemy.move_enemy(room)
        room.room_arch[enemy.posy][enemy.posx] = enemy.symbol #Better...

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2l3jo7mfejmzodu5rain.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2l3jo7mfejmzodu5rain.png" alt="Image description" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also sent the code of the user (2) to the room class Now it contains all the info of what is inside.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Draculinio/ChillGame" rel="noopener noreferrer"&gt;https://github.com/Draculinio/ChillGame&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To be continued...&lt;/p&gt;

</description>
      <category>python</category>
      <category>gamedev</category>
      <category>devjournal</category>
      <category>programming</category>
    </item>
    <item>
      <title>Making a Roguelike while chillin out part II</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Fri, 26 Jul 2024 13:09:04 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/making-a-roguelike-while-chillin-out-part-ii-53i6</link>
      <guid>https://dev.to/pablosoifer1/making-a-roguelike-while-chillin-out-part-ii-53i6</guid>
      <description>&lt;p&gt;Let's continue with the development of the roguelike in the chill &amp;amp; python sessions. &lt;br&gt;
As I mentioned earlier, when I have some free time and want to relax, I will turn on my youtube channel live streaming, put some cool music and start coding without pressure, just for fun.&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/live/vMTm9nnT9FU?feature=share" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--OGJzEKA0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.ytimg.com/vi/vMTm9nnT9FU/maxresdefault.jpg" height="450" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/live/vMTm9nnT9FU?feature=share" rel="noopener noreferrer" class="c-link"&gt;
          Chill out and #python sesión II - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Un poco de #pythonprogramming y música relajante para acompañarte. Ni microfonos ni camaras. Solo musica y codigo al azar.Cada tanto esto va a suceder.La mus...
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--aAqG4NAp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.youtube.com/s/desktop/bad7252b/img/favicon.ico" width="16" height="16"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;All what I am going to talk about is in the &lt;a href="https://github.com/Draculinio/ChillGame" rel="noopener noreferrer"&gt;game repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First I wanted to clear a little the code in the main zone, something like this, kind of standard in curses libraries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def main(stdscr):
     # my code here

wrapper(main)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From there it is way easier to code stuff, because even if now you see a lot of code there, in the future it will be easier to send the code to functions/classes.&lt;/p&gt;

&lt;p&gt;The second change that I did was changing the way you send commands. Instead of writing a command, I will expect an ascii code, so, depending on which key the player press, it will do different stuff.For keypad there are special curses commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;while command != 101:
        stdscr.addstr(p.posy,p.posx,'@',curses.color_pair(1)) #WRITE THE CHARACTER
        #We need to put any enemy that is available in the room
        for i in room.enemies:
            stdscr.addstr(i.posy,i.posx,i.symbol)
        print_player(p, stdscr)
        print_board(stdscr)
        print_room(room,stdscr)
        command = stdscr.getch() #Interesting, this returns an ASCII char...
        stdscr.erase()
        if command == curses.KEY_LEFT: #Interesting, if I want to have arrows I should not convert ascii...
            if p.posx&amp;gt;1:
                p.posx -=1
        if command == curses.KEY_RIGHT:
            if p.posx&amp;lt;79:
                p.posx +=1
        if command == curses.KEY_UP:
            if p.posy&amp;gt;2:
                p.posy -=1
        if command == curses.KEY_DOWN:
            if p.posy&amp;lt;22:
                p.posy +=1        #Yes, terrible...
        #Move enemies
        room.move_enemies()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, I don't expect 'exit' or 'e', I just expect ASCII code 101 (e) to finish the main loop.&lt;br&gt;
For movement of the character, now I have a position in x and y in the character class, so everytime the player press an arrow key, it moves.&lt;/p&gt;

&lt;p&gt;This is what I added in the player constructor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def __init__(self, name, creature):
        self.name = name
        self.creature = creature #let's start with human or elf.
        self.strength = 0
        self.defense = 0
        self.gold = 0
        self.room = '' #here is a question... do the character need to know where he is or the room should know who is there????
        self.posx = 10
        self.posy = 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The ifs that I put in arrow movement are because I assume that a terminal is 80x25 (there might be other configurations but, as I have to have fixed positions, I want to make it possible to be run in almost any terminal).&lt;/p&gt;

&lt;p&gt;Then is the enemies movement. I also added that position stuff to enemies in the room and gave them random movement in the room class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def move_enemies(self):
         for i in self.enemies:
            move = random.randint(1,4)
            if move == 1: 
                if i.posx&amp;gt;1:
                    i.posx -=1
            if move == 2:
                if i.posx&amp;lt;79:
                    i.posx +=1
            if move == 3:
                if i.posy&amp;gt;2:
                    i.posy -=1
            if move == 4:
                if i.posy&amp;lt;22:
                    i.posy +=1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I know there might be better ways to do this but for now, this works and as logic starts to be harder, I will move all this.&lt;/p&gt;

&lt;p&gt;Then added some colors and functions for the board and...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87ywlgteyry9dnx1x8nb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87ywlgteyry9dnx1x8nb.png" alt="Image description" width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I mentioned, in the article you have the repo, feel free to do whatever you want and subscribe to the channel!&lt;/p&gt;

</description>
      <category>python</category>
      <category>gamedev</category>
      <category>learning</category>
      <category>programming</category>
    </item>
    <item>
      <title>Making a Roguelike while chillin out part I</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Tue, 23 Jul 2024 21:25:58 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/making-a-roguelike-while-chillin-out-part-i-3cho</link>
      <guid>https://dev.to/pablosoifer1/making-a-roguelike-while-chillin-out-part-i-3cho</guid>
      <description>&lt;p&gt;A couple of days ago I was bored at home, nothing to do, so, I decided to stream &lt;a href="https://www.youtube.com/channel/UCix5mvzUSmq3K878G0KwMTA" rel="noopener noreferrer"&gt;in my youtube channel&lt;/a&gt;, just chill, some soft music and random code, no camera, no comments, just chill &amp;amp; python.&lt;/p&gt;

&lt;p&gt;This is the stream:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/live/6YTzMPHBmHk?si=uQSvGSSsnayOo_wG" rel="noopener noreferrer"&gt;Session I&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But as soon as I started coding I realized that I wanted to do a game. And not any game. Lately I was playing a lot of &lt;a href="https://en.wikipedia.org/wiki/Ancient_Domains_of_Mystery" rel="noopener noreferrer"&gt;ADOM&lt;/a&gt;, and was asking myself I would be able to do something like that, but in old school mode, to play this in the console (does not matter if it is windows or linux) like in the old and original Rogue or the old versions of ADOM&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3icbz52axmiubipwbkj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3icbz52axmiubipwbkj.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another thing that I have to mention about this is that I am a devote Pythonist. My mantra is "&lt;strong&gt;Python is love and love is Python&lt;/strong&gt;"&lt;/p&gt;

&lt;p&gt;With that in mind I started to code while listening to cool and relaxing music live on youtube.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some rules here:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I will keep on coding without a real plan or schedule. I have A LOT of work in real life, a family and other hobbies.&lt;/li&gt;
&lt;li&gt;I love old school games, so I will attach the idea of ADOM, Rogue or Angband.&lt;/li&gt;
&lt;li&gt;Permadeath. YES, it is important and will be like that.&lt;/li&gt;
&lt;li&gt;About randomly generated dungeons: I think that there should be both things. Random dungeons and fixed ones.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As for the libraries, I know that there are some cool things like &lt;a href="https://pypi.org/project/tcod/" rel="noopener noreferrer"&gt;tcod&lt;/a&gt; but I will go with the old and lovely curses. I know that the libraries for windows and linux are different, but they are very similar so I only need to verify which os I am using.&lt;/p&gt;

&lt;p&gt;First, I started by creating a character class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random

class Character:
    def __init__(self, name, creature):
        self.name = name
        self.creature = creature #let's start with human or elf.
        self.strength = 0
        self.defense = 0
        self.gold = 0
        self.room = ''

    def char_creator(self):
        str_mod = {'h':5, 'e':3}
        def_mod = {'h':4, 'e':3}
        self.strength = random.randint(1,6) + str_mod[self.creature]
        self.defense = random.randint(1,6) + def_mod[self.creature]

    def char_info(self):
        creatures = {'h':'Human', 'e':'Elf'} #maybe this may die.
        return {'name': self.name, 'creature': creatures[self.creature], 'strength': self.strength, 'defense': self.defense}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here I have a couple of questions. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Should the player generator be part of the character class? for now, yes, will see.
-** The player should know in which room he is? Or the room should contain the character, or both? This is a BIG BIG question**&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, I created a first version of the enemy class (all this was in 2 hours in a live stream, don't ask for speed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Enemies:
    def __init__(self, name, strength, defense): 
        self.name = name
        self.strenght = strength
        self.defense = defense
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MY biggest question here for the future is if the character and enemies should be classes that inherit from a base class. I don't know.&lt;/p&gt;

&lt;p&gt;Finaly, I made a room class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random
from enemies import Enemies
class Room:
    def __init__(self, name, description, enemies) -&amp;gt; None:
        self.name = name
        self.description = description
        #what kind of monsters can appear?
        self.possible_enemies = enemies #this will have a list of possible monsters that can appear in a room
        self.enemies = [] #this is getting weird...
    def describe_room(self):
        #TODO: show monsters in a better way
        enemies = ''
        for i in self.enemies:
            enemies += i.name+' '
        return {'name':self.name, 'description': self.description, 'enemies': enemies}

    def create_enemies(self):
        #we will do something better than this in the near future...
        for i in self.possible_enemies:
            #if random.randint(1,2) == 1: #a coin flip for appearance
                if i == 'rat':
                    self.enemies.append(Enemies('Rat', 2,2))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here a lot of magic will happen. For now, it is just a placement of the base code. But the room has a title, a description and some monsters that appear randomly.&lt;/p&gt;

&lt;p&gt;The principal with the main loop is just putting all together and a little main loop with a couple of commands (I will change the commands with key presses soon)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from character import Character
from room import Room
import curses

screen = curses.initscr()
screen.addstr(0,20,'---GAMEEEEEE---')
screen.addstr(2,0,'Enter a name: ')
name = screen.getstr().decode('utf-8') #here it is XD
screen.refresh()
creature_type = ''
while creature_type not in ['h','e']:
    screen.addstr(3,0,'What kind of creature do you want to be? (H-Human/E-Elf): ')
    creature_type = screen.getkey().lower()
p = Character(name, creature_type)
p.char_creator()
room = Room('Inside your house', 'This is your house',['rat'])
room.create_enemies()
#For now, let's write here, in the future we will do it better
p.room = room
screen.erase()
screen.addstr(3,0,'Hello,'+p.char_info()['name']+' you are a ' +p.char_info()['creature'])
screen.refresh()
#we need a main loop...
command = ''
while command != 'exit':
    screen.addstr(1,0,p.char_info()['name'])
    screen.addstr(5,0, p.room.describe_room()['name'])
    screen.addstr(20,0, 'Command: ')
    command = screen.getstr().decode('utf-8')
    screen.erase()
    #for now I will write some simple commands here, and then I will move them
    if command.lower() == 'describe':
        screen.addstr(8,0, 'Description: '+p.room.describe_room()['description'])
        screen.addstr(10,0, 'Enemies: '+p.room.describe_room()['enemies'])
    if command.lower() == 'stats':
        screen.addstr(8,0, 'Your stats: STR: '+ str(p.char_info()['strength'])+ ' DEF: '+str(p.char_info()['defense']))
curses.endwin()

print('Thank you for playing!')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I know that the actual code is &lt;strong&gt;TERRIBLE&lt;/strong&gt; but, it was 2 hours of chill out and non stressful coding, and this will continue in that way.&lt;/p&gt;

&lt;p&gt;If you want to see the repo: &lt;a href="https://github.com/Draculinio/ChillGame" rel="noopener noreferrer"&gt;https://github.com/Draculinio/ChillGame&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second stream? Soon enough I wish.&lt;/p&gt;

</description>
      <category>python</category>
      <category>gamedev</category>
      <category>programming</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>Writing a NES game day 16, offtopic I</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Sat, 29 Jul 2023 00:59:09 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/writing-a-nes-game-day-16-offtopic-i-1mp0</link>
      <guid>https://dev.to/pablosoifer1/writing-a-nes-game-day-16-offtopic-i-1mp0</guid>
      <description>&lt;p&gt;Hello, so I couldn't code anything today for the game, so when this happens I will post some related to the project thigs. &lt;br&gt;
First of all, this project started the day I left every social media. I was very hooked to Twitter, and one day I saw that it wasn't a good environment, nothing good comes from those platforms, I see people every day spending hours and hours on Instagram, Facebook, Twitter and others. I wasn't born in this era, half of my life I was offline and I think that some things from that era were better, sharing pictures and opinions only with family and friends, not having stupid fights with random people.&lt;br&gt;
At some point all this noise is not good. We are all very connected and at the same time not generating real connections with people.&lt;br&gt;
The day I decided to leave social networks I started to think what to do with my free time, think again about my hobbies, and now I use more time to draw and take classes with my daughters, learn more japanese (I am terrible bad at that, but, it is for fun) and I started this project which is a lot of fun.&lt;/p&gt;

&lt;p&gt;This is now the only place where I put my thoughts (I have a youtube channel but is in spanish).&lt;/p&gt;

&lt;p&gt;Life is so much better far from social media...&lt;/p&gt;

</description>
      <category>nintendo</category>
      <category>socialmedia</category>
    </item>
    <item>
      <title>Writing a NES game day 15, scrolling?</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Thu, 27 Jul 2023 21:45:39 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/writing-a-nes-game-day-15-scrolling-4k2g</link>
      <guid>https://dev.to/pablosoifer1/writing-a-nes-game-day-15-scrolling-4k2g</guid>
      <description>&lt;p&gt;As I am kind of stuck with backgrounds and how to put them, I have to decide something: &lt;/p&gt;

&lt;p&gt;As it is a platoform game, I have two possibilities for scrolling and movement.&lt;/p&gt;

&lt;p&gt;The first one is like you do in Megaman (or Rockman if you like the japanese version) where you have to walk from the beggining to the end of the screen to have a new one appearing.&lt;/p&gt;

&lt;p&gt;The second one is the way games like Ghost And Goblins work. It seems like you are moving but you are always in the middle of the screen and the background is what moves.&lt;/p&gt;

&lt;p&gt;I need to decide...&lt;/p&gt;

</description>
      <category>6502</category>
      <category>assembly</category>
      <category>nintendo</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Writing a NES game, day 14, newbie mistakes</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Wed, 26 Jul 2023 16:59:05 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/writing-a-nes-game-day-14-newbie-mistakes-760</link>
      <guid>https://dev.to/pablosoifer1/writing-a-nes-game-day-14-newbie-mistakes-760</guid>
      <description>&lt;p&gt;One thing that I noticed in the game was that everything was running BUT in a separate way. So, everytime an event was launched you could see the other events freezing. So, you can see for a moment in the shooting stage that monsters freezed (for a short ammount of time). Not to talk about holding left or right buttons and everything was waiting me to release the button.&lt;/p&gt;

&lt;p&gt;It was ALL caused because I had a &lt;strong&gt;NEWBIE **error. I was using JMP to move to subrutines. There is an especific instruction for that JSR (Jump to subrutine, the name is clear). JMP is just an unconditional jump, but the way to do this in the correct way is to use the correct jump instruction.&lt;br&gt;
I noticed all this while spending **HOURS&lt;/strong&gt; breaking my code to see why all the freezing errors happened (also sometimes randomly the program itself was freezed), looking at the obvious place: &lt;a href="https://www.masswerk.at/6502/6502_instruction_set.html"&gt;the instructions table&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was like 1 am when the solution appeared and I could fix all (yes, this is making me go to bed really late).&lt;/p&gt;

&lt;p&gt;Now the code is better with things like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;engineplaying:
;read button
    LDA button

right: 
    CMP #%00000001
    BNE rightDone
    JSR moveRight
rightDone:

left: 
    CMP #%00000010
    BNE leftDone
    JSR moveLeft
leftDone:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tomorrow we have to talk about how the scrolling will happen in the near future.&lt;/p&gt;

</description>
      <category>assembly</category>
      <category>6502</category>
      <category>nintendo</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Writing a NES game, day 13, no more moondance</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Tue, 25 Jul 2023 22:59:17 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/writing-a-nes-game-day-13-no-more-moondance-342f</link>
      <guid>https://dev.to/pablosoifer1/writing-a-nes-game-day-13-no-more-moondance-342f</guid>
      <description>&lt;p&gt;Up until now, when I moved left or right, the character was just changing the positions, but the character itself didn't change at all, when it was going left it just felt like "moonwalking". At least I need the character to be able to look to another direction when waking left.&lt;br&gt;
One problem with that is that creating new sprites for that can be kind of a "waste" because space is very limited, so, what I need to do is reuse the same sprites and flip them.&lt;/p&gt;

&lt;p&gt;First in ZEROPAGE segment I need a new variable which is for the direction, so 0 is right, 1 is left.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pdir: .res 1 ;player direction 00 right, 01 left
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second thing that I need is to update the value every time **moveLeft **or **moveRight **is called&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;moveLeft:
    LDA p1x
    SEC
    SBC #01
    STA p1x
    LDA p2x
    SEC
    SBC #01
    STA p2x
    LDA #$01
    STA pdir
    RTS

moveRight:
    LDA p1x
    CLC
    ADC #01
    STA p1x
    LDA p2x
    CLC
    ADC #01
    STA p2x
    LDA #$00
    STA pdir
    RTS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And finally, this will affect the update of the sprites, so I needed to do some changes here for the character part:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; LDA #$00
    CMP pdir
    BEQ rightCharTiles
    LDA #$01
    STA $0201
    LDA #$00
    STA $0205
    LDA #$11
    STA $0209
    LDA #$10
    STA $020D
    LDA #$40
    STA $0202
    STA $0206
    STA $020A
    STA $020E
    JMP charTilesDone
    rightCharTiles:
    LDA #$00
    STA $0201
    LDA #$01
    STA $0205
    LDA #$10
    STA $0209
    LDA #$11
    STA $020D
    LDA #$00
    STA $0202
    STA $0206
    STA $020A
    STA $020E
    charTilesDone:
    LDA p1y
    STA $0200
    STA $0204
    LDA p2y
    STA $0208
    STA $020C
    LDA p1x
    STA $0203
    STA $020B
    LDA p2x
    STA $0207
    STA $020F
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I can turn the character around:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D6S5QNDn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0t140clrrp10ypp69foe.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D6S5QNDn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0t140clrrp10ypp69foe.PNG" alt="Image description" width="364" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As always, the code can be found at &lt;a href="https://github.com/Draculinio/rindelia1"&gt;my github repo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>assembly</category>
      <category>6502</category>
      <category>nintend</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Writing a NES game day 12, The Aqualate!</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Mon, 24 Jul 2023 16:40:29 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/writing-a-nes-game-day-12-the-aqualate-j6j</link>
      <guid>https://dev.to/pablosoifer1/writing-a-nes-game-day-12-the-aqualate-j6j</guid>
      <description>&lt;p&gt;Now that the main character can shoot, it should shoot something, so I need to create enemies.&lt;br&gt;
When I was starting, my 7 year old daughter passed by my computer, asked me what I was doing and told me that she wanted to create the testing monster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZlcQu0wC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9n7u3b9v5agrms41ao0e.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZlcQu0wC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9n7u3b9v5agrms41ao0e.PNG" alt="Image description" width="800" height="590"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;She called this "The Aqualate". I needed this to be on screen and needed to make it move on its own, so I needed to create some of this beautiful code.&lt;/p&gt;

&lt;p&gt;First of all, I need 3 variables, one for the position in X, one for the position in Y and one for the stage of movement it is (we will go over it briefly).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ax: .res 1 ; Aqualate x position
 ay: .res 1 ; Aqualate y position
 al: .res 1 ; Aqualate in the loop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For now I put some initial values to place it somewhere&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LDA #$50
STA ax
LDA #$80
STA ay
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, I need a fixed pattern for the enemy, let's say an easy one, so let's make the Aqualate move in squares. Here comes the third variable into the game. The position status, the position has 4 status ($00, $01, $02 and $03), every status has a place and in every cicle the al variable increments in one and changes the place of ay and ax. If incrementing the variable results in $04, then it goes to $00 again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aqualate:
    LDA #$00 ;in the original position x+1, y-1
    CMP al
    BNE :+
    LDA ax
    CLC
    ADC #05
    STA ax
    LDA ay
    SEC
    SBC #05
    STA ay
    :
    LDA #$01 ;position 2 x+1, y+1
    CMP al 
    BNE :+
    LDA ax
    CLC
    ADC #05
    STA ax
    LDA ay
    CLC
    ADC #05
    STA ay
    :
    LDA #$02 ;position 3 x-1, y+1
    CMP al
    BNE :+
    LDA ax
    SEC
    SBC #05
    STA ax
    LDA ay
    CLC
    ADC #05
    STA ay
    :
    LDA #$03 ; position 4 x-1, y-1
    CMP al
    BNE :+
    LDA ax
    SEC
    SBC #05
    STA ax
    LDA ay
    SEC
    SBC #05
    STA ay
    :
    ;update
    LDA al
    CLC
    ADC #01
    STA al
    LDA #05
    CMP al
    BNE :+
    LDA #00
    STA al
    :
    RTS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And now in the engine zone, in every cicle I need to call this function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;JMP aqualate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last part is placing it into the screen, for that I assigned the aqualate the addresses from $0214 to $0217. So I only need to put this into the updatesprites function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;;Aqualate ($0214 to $0217)
    LDA ay
    STA $0214
    LDA #$02
    STA $0215
    LDA #$00
    STA $0216
    LDA ax
    STA $0217
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h4KF8dnW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ajg8b1yoqqiivtvb7kdy.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h4KF8dnW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ajg8b1yoqqiivtvb7kdy.PNG" alt="Image description" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And about Megaman 1, well, I could beat Cutman, but the rest is terribly hard. I have no skills :(&lt;/p&gt;

</description>
      <category>assembly</category>
      <category>6502</category>
      <category>nintendo</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Writing a NES game day 11, Fire!</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Sun, 23 Jul 2023 14:01:31 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/writing-a-nes-game-day-11-fire-3nod</link>
      <guid>https://dev.to/pablosoifer1/writing-a-nes-game-day-11-fire-3nod</guid>
      <description>&lt;p&gt;Now that I have my first version of the character, and he can move, I need to make him so something else. Remember that you can check the status of the code in my &lt;a href="https://github.com/Draculinio/rindelia1"&gt;github repo&lt;/a&gt;. &lt;br&gt;
I created a simple sprite for bullet which is a 2 colors circle (redoing sprites into something better is a problem for future me) and created 3 variables for this: sx (shoot in x axis), sy (shoot in y axis) for the position of the shoot every frame and a shootStatus to see if it is actually firing something or not (maybe in the future I can delete this variable and use a special value in sx and clean 1 byte?)&lt;br&gt;
For making this work, I added the shoot behaviour to button B in the engine sector:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bButton:
    CMP #%01000000
    BNE bDone
    LDA #$01
    STA shootStatus
    LDA p2x
    STA sx
    LDA p1y
    STA sy
bDone:

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, I see if the shooting is active and I jump to a shooting "function"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;;Shooting update
LDA #$01
CMP shootStatus
BNE :+
JMP shoot
:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then the shoot part:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shoot:
    ;for now it will only shoot to the right.
    LDA sx
    CLC
    ADC #01
    STA sx
    RTS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see I place a lot of comments, the code in assembly is not that "self readable" as other languages.&lt;/p&gt;

&lt;p&gt;Now, I have to update the sprites refresh to make all this visible.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LDA sy
    STA $0210
    LDA sx
    STA $0213
    LDA #$00
    STA $0212
    LDA #$01
    CMP shootStatus
    BEQ isShooting
    LDA #$FC
    STA $0211
    JMP shootDone
    isShooting:
    LDA #$30
    STA $0211
    shootDone:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As it is a one tile sprite, I only need 4 positions in memory, so I assigned it the $0210 to $0213 space.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Rqki8iSB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7gioozl2506x6fkudnv4.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rqki8iSB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7gioozl2506x6fkudnv4.PNG" alt="Image description" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(tomorrow we will talk about the other thing that appears on the screen)&lt;/p&gt;

&lt;p&gt;On the other hand, to keep me MORE motivated I am playing some nes games lately.  Not only Final Fantasy in japanese to learn, but I started Rockman (Megaman)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kt7_6ZNM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ep7hf3zgs3mwbz694lsz.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kt7_6ZNM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ep7hf3zgs3mwbz694lsz.PNG" alt="Image description" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have a child that loves video games, show them the old Nintendo games, for them this all will be in nightmare level.&lt;/p&gt;

</description>
      <category>nes</category>
      <category>assembly</category>
      <category>6502</category>
      <category>blog</category>
    </item>
    <item>
      <title>Writing a NES game day 10: Working with graphics</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Sat, 22 Jul 2023 12:23:11 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/writing-a-nes-game-day-10-working-with-graphics-2kie</link>
      <guid>https://dev.to/pablosoifer1/writing-a-nes-game-day-10-working-with-graphics-2kie</guid>
      <description>&lt;p&gt;Working with graphics for the NES can be a little... I won't say difficult, but it is not a walk in the park. As you have your chr file with tiles you have to accomodate them in the screen loading them into memory and using variables for the movement (and then again, the less variables, better for the future as we have to save all the possible memory)&lt;/p&gt;

&lt;p&gt;Given the CHR file that I have, I made things like this for the first version of the title screen:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;principal:
    .byte $1B,$12,$17,$0D,$0E,$15,$12,$0A,$24,$24,$24,$24,$24,$24,$24,$24 
    .byte $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24 

    .byte $24,$24,$1D,$11,$0E,$24,$15,$0E,$10,$0E,$17,$0D,$24,$24,$24,$24 
    .byte $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24 

    .byte $24,$24,$24,$24,$18,$0F,$24,$1D,$11,$0E,$24,$0F,$18,$1E,$1B,$24 
    .byte $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24  

    .byte $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$10 
    .byte $0E,$16,$1C,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is not, but let's say it is kind of an array of hexadecimal numbers, each one corresponding to a tile in the chr.&lt;/p&gt;

&lt;p&gt;After accomodating then in my "engine title zone":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;enginetitle:
    LDA $2002
    LDA #$20
    STA $2006
    LDA #$00
    STA $2006
    LDX #00
:
    LDA principal, X
    STA $2007
    INX
    CPX #$80
    BNE :-

    LDA $2002
    LDA #$23
    STA $2006
    LDA #$C0
    STA $2006
    LDX #$00
    waitforkeypress:
        LDA button
        CMP #%00010000
        BNE waitforkeypress
    LDA #PLAYING
    STA gamestate
    JMP clearscreen

    JMP GAMEENGINEDONE

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I made it appear as this (and as you can see in the waitforkeypress loop, it waits for start button).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p7J4YgVC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lfvviq5vi2jiplvnozzw.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p7J4YgVC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lfvviq5vi2jiplvnozzw.PNG" alt="Image description" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have to quit the render of the character from there, I put it in the vblank zone, have to see how to put it somewhere else, maybe a jump to see if it is in the presentation stage...&lt;/p&gt;

&lt;p&gt;Remember from the first days that I had the character being load from spritedata? It is something similar to the backgrond, something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spritedata:
    ;      Y   tile attr   X
    .byte $80, $00, $00, $10
    .byte $80, $01, $00, $18
    .byte $88, $10, $00, $10
    .byte $88, $11, $00, $18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Well, now I need it to have some variables to move it in the x/y axis, so I needed to create a couple of variables in the ZEROPAGE segment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;p1x: .res 1
p2x: .res 1
p1y: .res 1
p2y: .res 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And create a function (sprites load from $0200)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;updatesprites:
    ;I will have to do something to UPDATE ALL in the future
    LDA p1y
    STA $0200
    STA $0204
    LDA p2y
    STA $0208
    STA $020C
    LDA p1x
    STA $0203
    STA $020B
    LDA p2x
    STA $0207
    STA $020F
    LDA #$00 ;this is a tile, should have a variable? (also used for attributes now)
    STA $0201
    STA $0202
    STA $0206
    STA $020A
    STA $020E
    LDA #$01
    STA $0205
    LDA #$10
    STA $0209
    LDA #$11
    STA $020D

    CLI
    LDA #%10000000
    STA $2000

    LDA #%00010000
    STA $2001
    RTS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Maybe there are better ways to do this, but I am still learning.&lt;/p&gt;

</description>
      <category>nes</category>
      <category>assembly</category>
      <category>6502</category>
      <category>blog</category>
    </item>
    <item>
      <title>Writing a NES game, day 9, my friend ChatGPT</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Fri, 21 Jul 2023 15:24:50 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/writing-a-nes-game-day-9-my-friend-chatgpt-56nn</link>
      <guid>https://dev.to/pablosoifer1/writing-a-nes-game-day-9-my-friend-chatgpt-56nn</guid>
      <description>&lt;p&gt;Yesterday I started to do some more complicated code. That in assembler can be a REAL pain. At some point nothing was working and I didn't have a clue on why. In "normal" programming languages that can be easy to debug and fix and easy to see where the problem is (well, not all the time but you have a lot of hints), in this thing it is HARD, VERY HARD.&lt;br&gt;
In my desperation I asked chatgpt if he can help me with 6502 nes code and said yes.&lt;br&gt;
I had to copy all my code to the chat and after several iterations it started to work again.&lt;/p&gt;

&lt;p&gt;Now I think that chatgpt is not perfect and he misses the point some times, but it resembles me of coding with friends, see what is wrong and try to fix things. It is not a solution but a GREAT help.&lt;/p&gt;

&lt;p&gt;Now I have to fix something with the looping (seems that every time I release, the character goes again to the starting position but I think I know why...)&lt;/p&gt;

</description>
      <category>blog</category>
      <category>nes</category>
      <category>retroprogramming</category>
      <category>chatgpt</category>
    </item>
    <item>
      <title>Writing a NES game, day 8</title>
      <dc:creator>Draculinio</dc:creator>
      <pubDate>Thu, 20 Jul 2023 17:56:09 +0000</pubDate>
      <link>https://dev.to/pablosoifer1/writing-a-nes-game-day-8-2l3n</link>
      <guid>https://dev.to/pablosoifer1/writing-a-nes-game-day-8-2l3n</guid>
      <description>&lt;p&gt;8 days without social network, 8 days coding this. Someone can say that this is kind of my nicotine patch for Twitter.&lt;/p&gt;

&lt;p&gt;This is the temporary character that I will use to test all, until a better version appears:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i13-4Pni--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnle44mwx1xejcr7nt1j.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i13-4Pni--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnle44mwx1xejcr7nt1j.jpg" alt="Image description" width="272" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We also gave a name to the game (my daughters are helping me with names, story, some graphics, etc). It will be&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Rindelia, The Legend of the Four Gems&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And for now it will be open source, you can find the repo &lt;a href="https://github.com/Draculinio/rindelia1"&gt;here&lt;/a&gt; (for now I only have lik 300 hundread lines of code testing how this works, but with time I will convert it into a game).&lt;/p&gt;

&lt;p&gt;What I noticed is that I am starting to be passionate about programming again, like a second youth. The thing is that I am a developer, but I have to code for money, things that I am not interested into, but, we all have to put food on the table. I am starting to love this project. &lt;/p&gt;

</description>
      <category>nes</category>
      <category>retro</category>
      <category>nintendo</category>
      <category>blog</category>
    </item>
  </channel>
</rss>
