DIV ARENA FORUMS

Day 1 - Setup & player sprite

MikeDX - 3-3-2016 at 08:42 PM

All the code and assets for this tutorial are on github !


Firstly, you'll need to install DIV. If you haven't done so already, please grab the build for your system from our downloads page.


We're going to start by opening up the program and creation a new program, and a small FPG containing our player sprite.



Create a new program, using the menus. I've named mine "smb.prg"




Add the following lines of code to your new PRG as follows:


Code:
PROGRAM smb; BEGIN END



It should look like this in the editor window:




At this point your code doesn't do anything. You can run the program with F10 if you like - but it will just run and return back to the editor! :)



Now let's create our player graphic. Using DIV's editor we can do this easily.


Using the menus, create a new MAP 16 x 16 pixels.




You'll see the new map created in the DIV IDE




Double click on the black map we just created, and the graphics editor will open.

use the scroll wheel on your mouse, or press the 'z' key to zoom in on your graphic so it looks like this:



Now to draw our character!

We want to draw our player facing right (more about making him face left later) in our 2D world. so let's do this now. I've based mine on the mario graphic from super mario bros on the NES.




To do this we use the pixel editor.

using the pen tool we are going to draw some pixels!

Select the pen tool:



Then select a colour from our palette to paint with:






Now draw on the canvas, And create our player.



Choose different colour for your players skin, clothes and boots until you end up with something like this





Press escape, and return to the DIV desktop.

Now we create our FPG.

Create a new FPG in a similar way to creating our PRG:

use the FPG menu


type your fpg name in the box at the bottom (I've called mine smb.fpg)


Your empty fpg is ready to accept your graphics!


Drag and drop your player sprite into the fpg window





Once you've done that, a dialog will popup allowing you to name your graphic. I've called mine "stand". I've set the ID to 1 (we'll need this later). you can use any names you like.



Click "Accept". You should now see your graphic in the list


If you click the "images" checkbox, you can see little thumbnail of our player graphic.




Now we're ready to put him on screen!

Keywords learned in this lesson:

Code:
PROGRAM BEGIN END




See you in the next step

oskarg - 3-3-2016 at 09:18 PM

don't work.
disculpa si me expreso en castellano.Cuando creo un nuevo fpg e intento agregrar una imagen al fpg se cierra o cuando intento abrir un nuevo fpg y cargo su correspondiente paleta ,tambien el programa se cierra.
utilizo la ultima beta y windows xp.

MikeDX - 3-3-2016 at 09:38 PM

Please use the latest nightly build from http://div-arena.co.uk/downloads/nightly/


español no es un problema ;)

oskarg - 3-3-2016 at 11:00 PM

Hola,gracias por la comprension,pues no domino el ingles .
He bajado la ultima version div-beta-nightly-2016-03-03-24a88efa35-win32.zip y sigo teniendo el mismo problema.
Cuando creo un fpg e intento agregrar imagenes se cierra la aplicacion.
Cuando intento abrir un fpg externo tambien se cierra la aplicacion.

MikeDX - 3-3-2016 at 11:40 PM

Im going to test this build and see what is going on. I don't seem to get this problem :(

I created a new map and fpg, and dragged the image in - no problems....


oskarg - 4-3-2016 at 12:17 PM

hola,pues hay un bug,no se si es porque utilizo windows xp o bien por la tarjeta grafica ,tengo una ati radeon.:(

MikeDX - 4-3-2016 at 12:28 PM

oskarg this is really strange!

Where are you running DIV from? The desktop?

oskarg - 4-3-2016 at 12:50 PM

Lo que hago es ejecutarlo en unidad c,unidad de windows añado captura de pantallas,pues hace cosas raras.
Se cierra cuando trato de añadir un grafico al fpg o bien al abrirlo uno ya creado.


div0001.png - 36kB
Aqui se observa que solo visualiza el smb.fpg ,pero no el help.fpg que he agregado a la carpeta ?¿?
si cargo el help.fpg o cualquier otro al cargar la paleta se cierra el programa.

Si cargo el smb.fpg .carga la paleta pero el fpg se muestra vacio.


div0002.png - 143kB


He cargado el fpg con el div2 original (msdos)que tengo y funciona correctamente

MikeDX - 4-3-2016 at 01:12 PM

To see all the FPG, use *.* (this is a windows bug)

I'd like to get this working for you. So the thumbnails are not showing...

The dac bug was fixed (a problem with beta 10) - this is what confuses me the most.


TransDiv - 12-3-2016 at 10:58 AM

I also have the same problem; I can't open an FPG or create a new one, DIV exit to Windows (Windows 7 - 64 bits - i5 - 16BG Ram). :(

MikeDX - 12-3-2016 at 01:04 PM

I'm going to look into this today - it's possible its a permissions problem.

Also I am going to try to fix the file browser and list the drives available.

*update*

I have now uploaded beta 11, this should hopefully fix a few things :)

oskarg - 12-3-2016 at 09:59 PM

Hola Mikedx
Todavia permanece el bug en la ultima version,si sirve de algo te cuento que he instalado en virtualbox el windows7 y me da el mismo error que si lo ejecutara en windows xp.Ojala encuentres el problema,pues no puedo abrir fpgs ni crearlos desde div3.

MikeDX - 12-3-2016 at 11:08 PM

Quote: Originally posted by oskarg  
Hola Mikedx
Todavia permanece el bug en la ultima version,si sirve de algo te cuento que he instalado en virtualbox el windows7 y me da el mismo error que si lo ejecutara en windows xp.Ojala encuentres el problema,pues no puedo abrir fpgs ni crearlos desde div3.


I can't replicate this bug :(

TransDiv - 12-3-2016 at 11:28 PM

I can confirm the bug is still there. It's not a problem related to video graphics card; I tested it in an ATI and a NVIDEA and both have the same problem (both Win7-64bits)

MikeDX - 12-3-2016 at 11:52 PM

Quote: Originally posted by TransDiv  
I can confirm the bug is still there. It's not a problem related to video graphics card; I tested it in an ATI and a NVIDEA and both have the same problem (both Win7-64bits)


I've just tried it in windows 7, loading an fpg just crashes the system

the only workaround is to run it from a cmd prompt, then cd to where div is, and run d.exe

I will look into this...

oskarg - 13-3-2016 at 06:51 AM

Gracias MikeDx por la informacion sobre cmd prompt,pues de esta manera puedo cargar y crear fpgs desde windowsxp.:blush:

Otra cuestion,podrias configurar el teclado español?¿?lo digo porque no hay manera de escribir la ñ o bien la _ :lol: o indicarme como escribo la _

MikeDX - 13-3-2016 at 02:10 PM

I don't know how to enable international keys.... I will see what i can do :)