The following warnings occurred:
Warning [2] Undefined variable $tcount - Line: 717 - File: portal.php PHP 8.0.17 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/portal.php 717 errorHandler->error_callback
Warning [2] Undefined variable $tcount - Line: 722 - File: portal.php PHP 8.0.17 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/portal.php 722 errorHandler->error_callback




Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 751
» Latest member: dvicelulares
» Forum threads: 192
» Forum posts: 1,397

Full Statistics

Online Users
There are currently 40 online users.
» 0 Member(s) | 39 Guest(s)
Bing

Latest Threads
Naalaa logo and icons
Forum: Showcase
Last Post: hiuwai
46 minutes ago
» Replies: 90
» Views: 6,105
Breakthrough Arkanoid
Forum: N7
Last Post: johnno1956
3 hours ago
» Replies: 44
» Views: 793
Tilemap library update
Forum: Announcements
Last Post: johnno1956
4 hours ago
» Replies: 2
» Views: 21
What games are you playin...
Forum: Local pub
Last Post: Aurel
Yesterday, 06:16 AM
» Replies: 5
» Views: 94
Drag-and-drop game tools
Forum: Local pub
Last Post: hiuwai
05-21-2022, 10:40 PM
» Replies: 10
» Views: 361
C64 Loading?
Forum: Questions and discussions
Last Post: johnno1956
05-19-2022, 07:42 PM
» Replies: 12
» Views: 391
Game runs at the same spe...
Forum: Questions and discussions
Last Post: Psygnosis
05-17-2022, 10:31 AM
» Replies: 4
» Views: 924
N7 version 22.05.12b
Forum: Announcements
Last Post: Psygnosis
05-16-2022, 02:16 PM
» Replies: 3
» Views: 212
JSON library
Forum: N7
Last Post: johnno1956
05-15-2022, 09:21 AM
» Replies: 1
» Views: 124
Platformer graphics - NES...
Forum: Free to use assets
Last Post: Marcus
05-14-2022, 01:17 PM
» Replies: 2
» Views: 156

 
  Tilemap library update
Posted by: Marcus - 11 hours ago - Forum: Announcements - Replies (2)

I actually started writing a game using the tilemap library, and I found a bunch of stuff that didn't work as intended. Here's an updated version of the library where the collision handling works exactly as it did in n5/n6.



Attached Files
.n7   tilemap.n7 (Size: 21.46 KB / Downloads: 3)
Print this item

  What games are you playing?
Posted by: Marcus - 05-24-2022, 06:05 PM - Forum: Local pub - Replies (5)

Just a bit curious about what games or type of games you're playing. I'm a sucker for single and multiplayer first person shooters. I play most of them on Nintendo Switch, been a Nintendo fan boy since I was a kid and got an NES. I spend way too much of my spare time on playing games, that's for sure Smile

Currently I'm playing Borderlands 2 on the Switch and Team Fortress 2 on PC (I've played that game for almost 6,000 hours in total).

Edit Forgot, I also like horror games, but not the action based ones. Layers of Fear is a good example of what I enjoy playing, story driven with puzzles.

Edit 2 And Minecraft Dungeons. I like Minecraft Dungeons.

Print this item

  Breakthrough Arkanoid
Posted by: johnno1956 - 05-19-2022, 08:27 PM - Forum: N7 - Replies (44)

Marcus,

I am starting to work on the old Naalaa 'Arkanoid', using your example of 'Breakthrough', and noticed something odd... No. Not an error but odd.

I cannot recall who said it or when, but I recall that Linux has a problem with "creating" fonts...

I was working through the 'Breakthrough' examples and left in the line "Set font createfont... etc" and gave it no thought. The code used 'arial' as the source font. As I said, no thought. The line of code worked. Modified the font size and it worked. Then I had my suspicions... I figured that the reason why 'create font' did not work was because, at the time 'arial' by default, is not a system-wide font. In my case, I had installed all of the MS-core fonts. Tested the theory... This time I installed 'impact' font. Bingo. But then chose a font that I did not have installed ("chiller")... This time the rendered text was a mono-styled font... Installed "chiller" font and it worked...

Just thought I would let you know...

By the way... So far I have modified breakthrough to display the graphics of Arkanoid... Collision detection, on the whole, works fine. 'Bouncing' off a brick corner sometimes does not work, rare, but happens... not a deal breaker.  Found it a little annoying that the direction of the ball initially is 'down'. Unless I have the paddle positioned 'just so', when the game starts, the ball goes off screen.

'Off screen'.  In one of the later examples you included the TM command to set the borders. As I am still in "example 2", I copied that command, but for some reason it did not work. The 'release' of the border (bottom) worked but the game did not exit. I looked through the later examples but did not see any other command required... no big deal... I just told the game to end if ball.y > height(primary)

Level, Score and Lives are 'hard coded' for reference only...


J

   

Print this item

Question C64 Loading?
Posted by: Psygnosis - 05-16-2022, 01:41 PM - Forum: Questions and discussions - Replies (12)

I have try to get close to C64 Loading but it doesn't look quite right

Code:
set window "C64 LOADING SCREEN", 1024, 768
set redraw off

t = clock()

do 
    for a=1 to 1024
        set color rnd(256), rnd(256), rnd(256), rnd(256)
        draw rect 0, a, 768, 1024
    next

    redraw
    fwait 60
until clock() - t > 15000

Print this item

  JSON library
Posted by: Marcus - 05-15-2022, 09:13 AM - Forum: N7 - Replies (1)

Here's a library for reading json strings/files into naalaa tables and converting naalaa tables to json strings. 

I'll post some useful examples soon. But there are just three functions: JSON_FromFile(filename), JSON_FromString(string) and JSON_ToString(table).

If you have a string/file with the content:

Code:
[
  {
    "name": "Marcus",
    "age": 43,
    "hair": "gray"
  },
  {
    "name": "Shitpickle",
    "age": 143,
    "hair": "brown"
  } 
]
 

JSON_FromString/JSON_FromFile would return an array containing two objects with the keys "name", "age" and "hair". And if you used JSON_ToString on that array, it would create a (compact) string with the same content.


Library source code:
Code:
' JSON library
' ------------
' By Marcus.

constant JPARSER_ERROR = 0,
        JPARSER_NUMBER = 1,
        JPARSER_STRING = 2,
        JPARSER_CHAR = 3,
        JPARSER_NULL = 4,
        JPARSER_END = 5

visible vString, vPos
visible vType, vValue
visible vTypes = ["error", "number", "string", "char", "null", "end"]

' JSON_ToString
' -------------
function JSON_ToString(v)
    select typeof(v)
        case TYPE_NUMBER
            txt = str(v)
        case TYPE_STRING
            txt = chr(34) + v + chr(34)
        case TYPE_TABLE
            if key(v, 0)
                txt = "["
                if sizeof(v)
                    for i = 0 to sizeof(v) - 1
                        txt = txt + JSON_ToString(v[i])
                        if i < sizeof(v) - 1  txt = txt + ","
                    next
                endif
                txt = txt + "]"
            else
                txt = "{"
                if sizeof(v)
                    i = 1
                    foreach ky, va in v
                        txt = txt + chr(34) + ky + chr(34) + ":" + JSON_ToString(va)
                        if i < sizeof(v)  txt = txt + ","
                        i = i + 1
                    next
                endif
                txt = txt + "}"
            endif           
        default
            txt = "null"
    endsel
    return txt
endfunc

' JSON_FromFile
' -------------
function JSON_FromFile(filename)
    f = openfile(filename)
    if not typeof(f) return unset
    json = ""
    s = frln(f)
    while typeof(s)
        json = json + s
        s = frln(f)
    wend
    free file f
    return JSON_FromString(json)
endfunc

' JSON_FromString
' ---------------
function JSON_FromString(txt)
    vString = txt
    vPos = 0
    GetNext()
   
    if vType = JPARSER_CHAR and vValue = 123
        return ParseObject()
    elseif vType = JPARSER_CHAR and vValue = 91
        return ParseArray()
    elseif vType = JPARSER_NUMBER or vType = JPARSER_STRING or vType = JPARSER_NULL
        return vValue
    else
        return unset
    endif
   
    ' ParseObject
    ' -----------
    function ParseObject()
        ExpectChar(123)
        obj = []
        do
            ExpectType(JPARSER_STRING)
            name = vValue
            GetNext()
            ExpectChar(58)
            select vType
                case JPARSER_STRING
                    obj[name] = vValue
                    GetNext()
                case JPARSER_NUMBER
                    obj[name] = vValue
                    GetNext()
                case JPARSER_NULL
                    obj[name] = vValue
                    GetNext()
                case JPARSER_CHAR
                    select vValue
                        case 123  obj[name] = ParseObject()
                        case 91  obj[name] = ParseArray()
                        default  assert "JSON: Unexpected char " + chr(vValue)
                    endsel
                default
                    assert "JSON: Error"
            endsel
        until not CouldGetChar(44)
        ExpectChar(125)
        return obj
    endfunc
   
    ' ParseArray
    ' ----------
    function ParseArray()
        ExpectChar(91)
        arr = []
        do
            select vType
                case JPARSER_STRING
                    arr[sizeof(arr)] = vValue
                    GetNext()
                case JPARSER_NUMBER
                    arr[sizeof(arr)] = vValue
                    GetNext()
                case JPARSER_NULL
                    arr[sizeof(arr)] = vValue
                    GetNext()
                case JPARSER_CHAR
                    select vValue
                        case 123  arr[sizeof(arr)] = ParseObject()
                        case 91  arr[sizeof(arr)] = ParseArray()
                        default  assert "JSON: Unexpected char " + chr(vValue)
                    endsel
                default
                    assert "JSON: Error"
            endsel
        until not CouldGetChar(44)
        ExpectChar(93)
        return arr   
    endfunc
   
    ' CouldGetChar
    ' ------------
    function CouldGetChar(value)
        if vType = JPARSER_CHAR and vValue = value
            GetNext()
            return true
        else
            return false
        endif
    endfunc
   
    ' ExpectChar
    ' ----------
    function ExpectChar(value)
        assert vType = JPARSER_CHAR and vValue = value, "JSON: Expected " + chr(value)
        GetNext()
    endfunc
   
    ' ExpectType
    ' ----------
    function ExpectType(type)
        assert vType = type, "JSON: Expected " + vTypes[type]
    endfunc
   
    ' GetNext
    ' -------
    function GetNext()
        c = asc(mid(vString, vPos))
        vPos = vPos + 1
        if c = 0
            vType = JPARSER_END
            return
        endif
        while c = 32 or c = 9 or c = 10 or c = 13
            c = asc(mid(vString, vPos))
            vPos = vPos + 1
        wend
        if c = 34
            tmp = ""
            c = asc(mid(vString, vPos))
            vPos = vPos + 1
            while c <> 34
                tmp = tmp + chr(c)
                c = asc(mid(vString, vPos))
                vPos = vPos + 1
            wend
            vType = JPARSER_STRING
            vValue = tmp
        elseif IsDigit(c) or c = 45
            tmp = chr(c)
            dot = false
            c = asc(mid(vString, vPos))
            vPos = vPos + 1
            while IsDigit(c) or (c = 46 and not dot)
                tmp = tmp + chr(c)
                if c = 46  dot = true
                c = asc(mid(vString, vPos))
                vPos = vPos + 1
            wend
            vPos = vPos - 1
            vType = JPARSER_NUMBER
            vValue = float(tmp)
        elseif IsAlpha(c)
            tmp = chr(c)
            c = asc(mid(vString, vPos))
            vPos = vPos + 1
            while IsAlpha(c)
                tmp = tmp + chr(c)
                c = asc(mid(vString, vPos))
                vPos = vPos + 1
            wend
            vPos = vPos - 1
            select tmp
                case "null"
                    vType = JPARSER_NULL
                    vValue = unset
                case "true"
                    vType = JPARSER_NUMBER
                    vValue = 1
                case "false"
                    vType = JPARSER_NUMBER
                    vValue = 0
                default
                    assert "JSON: Unexpected " + tmp
            endsel
        else
            vType = JPARSER_CHAR
            vValue = c
        endif
    endfunc

    ' IsDigit
    ' -------   
    function IsDigit(c)
        return c >= 48 and c <= 57
    endfunc
   
    ' IsAlpha
    ' -------
    function IsAlpha(c)
        return c >= 65 and c <= 90 or c >= 97 and c <= 122
    endfunc
endfunc



Attached Files
.n7   json.n7 (Size: 6.9 KB / Downloads: 2)
Print this item

  Drag-and-drop game tools
Posted by: hiuwai - 05-15-2022, 12:38 AM - Forum: Local pub - Replies (10)

Drag-and-drop game tools are so popular in recent years and a lot of beginners start learning game development with this type of tool.

GameMaker Studio is one of the poplular drag-and-drop tools:

12635 items( https://itch.io/games/made-with-gamemaker )

Although drag-and-drop game tools dominate the whole game development world, many people still like to create games in pure languages! Wink

Examples:

Pygame: 551 items( https://itch.io/games/made-with-pygame )
Love2D: 1467 items( https://itch.io/games/made-with-love2d )
Rust: 149 items( https://itch.io/games/made-with-rust )
AppGameKit: 135 items( https://itch.io/games/made-with-appgamekit )

Print this item

  Platformer graphics - NES style
Posted by: Marcus - 05-14-2022, 06:11 AM - Forum: Free to use assets - Replies (2)

Here's the graphics from an NES style platform game that I released on google play some years ago. Max 3 colors per sprite and 4 colors per tile, obeying the NES limitations regarding number of palettes et.c. I declare it public domain now.

You can download the game apk file from here: https://naalaa.com/tmp/lsc.apk

Edit A json library is on the way ...



Attached Files Thumbnail(s)
   

.json   lsc_assets.json (Size: 44.25 KB / Downloads: 2)
Print this item

  Breakout graphics - NES style
Posted by: Marcus - 05-14-2022, 06:10 AM - Forum: Free to use assets - No Replies

Here's the graphics from an NES style breakout game that I released on google play some years ago. Max 3 colors per sprite and 4 colors per tile, obeying the NES limitations regarding number of palettes et.c. I declare it public domain now.

You can download the game apk file from here: https://naalaa.com/tmp/ctr.apk



Attached Files Thumbnail(s)
   

.json   ctr_assets.json (Size: 33.31 KB / Downloads: 1)
Print this item

  N7 version 22.05.12b
Posted by: Marcus - 05-12-2022, 03:18 PM - Forum: Announcements - Replies (3)

This is a small "NED" update - the compiler or runtime haven't changed. But it also includes a 5 step tutorial for a breakout:ish game using the tilemap library.

https://naalaa.com/n7/N7_220512.zip

[Image: ned_functions.jpg]

Now you can navigate your source code a bit easier through the function list on the right. Click on a function in the list to jump to its location or hover over it with the mouse cursor to view parameter information in a tooltip.

Release notes
2022-05-12
* Added syntax help to NED
* Added function lists to NED
* Fixed some bugs in the tilemap library

Print this item

  Slope hack for Tilemaps
Posted by: kcfb - 05-11-2022, 03:47 PM - Forum: N7 - Replies (4)

Sloping tiles were not catered for in N6, but Marcus was kind enough to provide a "slope hack" which effectively allowed the use of 45 degree slopes.
Attached is a N7 conversion of this hack. This is a (pretty) straight conversion, and because of this, it makes no use whatsoever of any new features provided in N7. It's here merely to demonstrate how slopes may currently be implemented in N7 tilemap games. Note that if you add sloping tiles, they must have no collision attached, and you may need to change the cell number referenced in lines 86 & 104 to whichever cells you have in your sprite sheet for the sloping tiles.

Thanks to Marcus for the original N6 code and graphics.


.zip   slope hack for N7 Tilemap.zip (Size: 441.52 KB / Downloads: 8)

Bad attachment previously the above should now work.....

Print this item