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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 21
» Latest member: Kerl
» Forum threads: 16
» Forum posts: 71

Full Statistics

Online Users
There are currently 2 online users.
» 1 Member(s) | 1 Guest(s)
johnno56

Latest Threads
Splot Version 2
Forum: Showcase
Last Post: Marcus
02-17-2018, 11:13 AM
» Replies: 7
» Views: 136
Tilemaps with slopes
Forum: Showcase
Last Post: kcfb
02-16-2018, 06:40 AM
» Replies: 5
» Views: 164
Focus Window
Forum: Linux specific
Last Post: johnno56
02-15-2018, 08:19 PM
» Replies: 4
» Views: 73
Julia set
Forum: Showcase
Last Post: cvirus
02-13-2018, 12:17 PM
» Replies: 2
» Views: 57
Top down scrolling tilema...
Forum: Showcase
Last Post: kcfb
02-11-2018, 04:24 PM
» Replies: 5
» Views: 189
Tetris tutorial
Forum: Showcase
Last Post: Marcus
02-11-2018, 11:59 AM
» Replies: 2
» Views: 91
switch
Forum: Questions and discussions
Last Post: Marcus
02-08-2018, 03:34 PM
» Replies: 1
» Views: 70
Spam bots
Forum: Questions and discussions
Last Post: Tomaaz
02-07-2018, 10:13 PM
» Replies: 3
» Views: 115
Hidden Gem!
Forum: Questions and discussions
Last Post: kcfb
02-07-2018, 09:20 PM
» Replies: 6
» Views: 202
Space shootemup movement ...
Forum: Showcase
Last Post: Marcus
02-07-2018, 06:11 PM
» Replies: 0
» Views: 53

 
  Focus Window
Posted by: johnno56 - 02-14-2018, 01:23 PM - Forum: Linux specific - Replies (4)

Not sure how else to title the post.

I have downloaded and installed the latest Linux 64 bit version and noticed a slight problem.

After loading a couple of the sample games then select compile/run. The "game" window pops up (as it should) but the "focus" is still on the editor. I had to click the title bar of the newly formed game window before I could control/play the game(s).

I hope that I am making sense...

By the way. The editor works really well. Loading and compiling is very fast and runs very well indeed.

Can I assume that the Tile Map Editor and the Raycaster might be a little more difficult to convert to Linux? I can still run the Windows version via Wine in the meantime...

A very good job converting the editor! Well done.

J

ps: As a "Junior Member" shouldn't I only have one "yellow star"? Just curious...

Print this item

  Splot Version 2
Posted by: Rick3137 - 02-13-2018, 05:17 PM - Forum: Showcase - Replies (7)

This is version 2 of a simple board game I posted in the old forum.

[Image: Splot2.png]



Attached Files
.zip   SplotV2.zip (Size: 841.83 KB / Downloads: 1)
Print this item

Photo Julia set
Posted by: cvirus - 02-13-2018, 09:59 AM - Forum: Showcase - Replies (2)

Code:
visible:  
   zoom = 1
   moveX = 0
   moveY = 0
   maxIterations = 300
   colorHSVo?
   colorRGB?

hidden:

set window 32, 32, 400, 300, false, 1
set redraw off


procedure colorHSV(h, s, v)
   colorHSVo.h = h
   colorHSVo.s = s
   colorHSVo.v = v
endproc

procedure HSVtoRGB()
   h# = float#(colorHSVo.h) / 256.0
   s# = float#(colorHSVo.s) / 256.0
   v# = float#(colorHSVo.v) / 256.0
   
   if (s# = 0.0)
       r# = v#
       g# = v#
       b# = v#
   else
       h# = h# * 6.0
       i = int(h#)
       f# = h# - float#(i)

       p# = v# * (1.0 - s#)
       q# = v# * (1.0 - (s# * f#))
       t# = v# * (1.0 - (s# * (1.0 - f#)))

       if i = 0  
           r#=v#;g#=t#;b#=p#
       elseif i = 1
            r#=q#; g#=v#; b#=p#
       elseif i = 2
           r#=p#; g#=v#; b#=t#
       elseif i = 3
           r#=p#; g#=q#; b#=v#
       elseif i = 4
           r#=t#; g#=p#; b#=v#
       elseif i = 5
           r#=v#; g#=p#; b#=q#
       else
           r#=0.0; g#=0.0; b#=0.0
       endif
   endif

   colorRGB.r = int(r*255.0)
   colorRGB.g = int(g*255.0)
   colorRGB.b = int(b*255.0)
endfunc

cRe# = -0.7; cIm# = 0.27015
newRe# = 0.0; newIm# = 0.0
val = 0

for y = 0 to height(primary)
   for x = 0 to width(primary)
       newRe# = float#(1.5 * (float#(x) - float#(width(primary)) / 2.0) / (0.5 * float#(zoom) * float#(width(primary))) + float#(moveX))
       newIm# = float#((float#(y) - float#(height(primary)) / 2.0) / (0.5 * float#(zoom) * float#(height(primary))) + float#(moveY));
       for i = 0 to maxIterations
           oldRe# = newRe#
           oldIm# = newIm#
           newRe# = oldRe# * oldRe# - oldIm# * oldIm# + cRe#
           newIm# = 2.0 * oldRe# * oldIm# + cIm#
           if (newRe# * newRe# + newIm# * newIm#) > 4.0 then break
       next
       if (i < maxIterations)
           val = 1
       else
           val = 0
       endif
       _colorHSV i % 256, 255, 255 * val
       _HSVtoRGB
       set color colorRGB.r, colorRGB.g, colorRGB.b
       draw pixel x, y
   next
next
redraw
wait mousebutton

[Image: naalaa_julia1.png]

Print this item

  Tetris tutorial
Posted by: Marcus - 02-10-2018, 02:04 PM - Forum: Showcase - Replies (2)

The zip attached to this post contains all the steps of the tutorial written (so far).

There are two versions of each source code file in the zip, one ending with .nala and one with .txt. They're identical, but NED on Linux only does syntax highlighting on files ending with .nala, and the Windows version of the compiler expects the file ending to be .txt. Just saving you from all the trouble of changing the filename.

Ask if anything is unclear, looks weird or needs further explaining Smile



Attached Files
.zip   tetris_tutorial.zip (Size: 105.44 KB / Downloads: 8)
Print this item

  switch
Posted by: cvirus - 02-08-2018, 03:22 PM - Forum: Questions and discussions - Replies (1)

Is there a switch command in NaaLaa? I did not found it in the old docs of NaaLaa 5.

Is it possible to allow this type of programming in NaaLaa

i, b, c vars in line with just  one separator

what about this one?
i = b = c = 0

Print this item

  Space shootemup movement paths
Posted by: Marcus - 02-07-2018, 06:11 PM - Forum: Showcase - No Replies

An example of using bezier curves for enemy movements in a (space) shooter.

Code:
' ==============================================================================
' Random paths.
' ==============================================================================

import "Keycodes.lib"
import "Speed.lib"

' Array of enemies.
enemies?[32]

' Clear all enemies.
for i = 0 to sizeof(enemies) - 1
    _ClearEnemy enemies[i]
next

' Active curve that spawning enemies will inherit.
activeCurve?
_CreateEnemyCurve activeCurve
' Curve will change every five seconds.
curveChangeTimer = 5*60

' Two enemies will spawn every second.
enemySpawnTimer = 0

' Turn off automatic redraw.
set redraw off

' ------------------------------------------------------------------------------
' Game loop.
' ------------------------------------------------------------------------------
do
    ' Update ---------------------------------------------------------------------

    ' Create new curve?
    curveChangeTimer = curveChangeTimer - 1
    if curveChangeTimer <= 0
        ' Set timer to 5*60 ticks (5 seconds)
        curveChangeTimer = 5*60
        _CreateEnemyCurve activeCurve
    endif

    ' Spawn a new enemy?
    enemySpawnTimer = enemySpawnTimer - 1
    if enemySpawnTimer <= 0
        ' Set timer to 30 ticks (half a second).
        enemySpawnTimer = 1*30
        ' Find an inactive enemy.
        for i = 0 to sizeof(enemies) - 1
            if not enemies[i].act then break
        next
        ' Did we find an empty spot?
        if i < sizeof(enemies)
            _ClearEnemy enemies[i]
            enemies[i].act = true
            _CopyCurve enemies[i], activeCurve            
        endif
    endif

    ' Update enemies.
    for i = 0 to sizeof(enemies) - 1
        ' Only update enemy if it's active.
        if enemies[i].act then _UpdateEnemy enemies[i]
    next

    ' Draw -----------------------------------------------------------------------

    ' Clear screen.
    set color 0, 0, 0
    cls

    ' Draw enemies.
    set color 255, 255, 255
    for i = 0 to sizeof(enemies) - 1
        if enemies[i].act then _DrawEnemy enemies[i]
    next

    redraw
    _SPD_HoldFrame 60
until keydown(VK_ESC, true)

' ==============================================================================
' Clear enemy.
' ==============================================================================
procedure ClearEnemy(&enemy?)
    ' Active flag.
    enemy.act = false
    ' Bezier curve control points.
    enemy.x0# = 0.0
    enemy.y0# = 0.0
    enemy.x1# = 0.0
    enemy.y1# = 0.0
    enemy.x2# = 0.0
    enemy.y2# = 0.0
    enemy.x3# = 0.0
    enemy.y3# = 0.0
    ' Bezier curve param, [0..1]
    enemy.p# = 0.0
    ' Parameter speed for curve
    enemy.spd# = 0.005
    ' Actual position.
    enemy.x = 0
    enemy.y = 0
endproc

' ==============================================================================
' Update enemy.
' ==============================================================================
procedure UpdateEnemy(&enemy?)
    ' Increase curve parameter.
    enemy.p# = enemy.p# + enemy.spd#
    ' Inactivate if end of curve has been reached.
    if enemy.p# > 1.0
        enemy.act = false
    endif
    ' Evaluate position.
    ip# = (1.0 - enemy.p#)
    b0# = ip*ip*ip
    b1# = 3.0*ip*ip*enemy.p#
    b2# = 3.0*ip*enemy.p#*enemy.p#
    b3# = enemy.p#*enemy.p#*enemy.p#
    enemy.x = int(b0*enemy.x0# + b1*enemy.x1# + b2*enemy.x2# + b3*enemy.x3#) - 16
    enemy.y = int(b0*enemy.y0# + b1*enemy.y1# + b2*enemy.y2# + b3*enemy.y3#) - 16
endproc

' ==============================================================================
' Draw enemy.
' ==============================================================================
procedure DrawEnemy(&enemy?)
    draw rect enemy.x, enemy.y, 32, 32, true
endproc

' ==============================================================================
' Create enemy curve.
' ==============================================================================
procedure CreateEnemyCurve(&c?)
    ' Start at upper, left or right edge of the screen.
    r = rnd(3)
    if r = 0
        ' On Linux, you can skip 'float' and use rnd(640.0)
        c.x0# = float(rnd(640))
        c.y0# = -16.0
    elseif r = 1
        c.x0# = -16.0
        c.y0# = float(rnd(480))
    else
        c.x0# = 656.0
        c.y0# = float(rnd(480))
    endif

    ' End at any screen edge.
    r = rnd(4)
    if r = 0
        c.x3# = float(rnd(640))
        c.y3# = -16.0
    elseif r = 1
        c.x3# = float(rnd(640))
        c.y3# = 496.0
    elseif r = 2
        c.x3# = -16.0
        c.y3# = float(rnd(480))
    else
        c.x3# = 656.0
        c.y3# = float(rnd(480))
    endif

    ' Completely random middle control points.
    c.x1# = float(rnd(640))
    c.y1# = float(rnd(480))
    c.x2# = float(rnd(640))
    c.y2# = float(rnd(480))
endproc

' ==============================================================================
' Copy curve.
' ==============================================================================
procedure CopyCurve(&dst?, &src?)
    dst.x0# = src.x0#
    dst.y0# = src.y0#
    dst.x1# = src.x1#
    dst.y1# = src.y1#
    dst.x2# = src.x2#
    dst.y2# = src.y2#
    dst.x3# = src.x3#
    dst.y3# = src.y3#
endproc



Attached Files
.txt   rndmov.txt (Size: 4.79 KB / Downloads: 5)
Print this item

  Spam bots
Posted by: Tomaaz - 02-05-2018, 08:57 AM - Forum: Questions and discussions - Replies (3)

Forum has been already invaded by spam bots. The only way to avoid this is to manually aprove all new accounts. If that's not possible then using something like Proboards could be an option (I assume that on a forum system like that it would be more difficult for bots to break through).

Print this item

  Is redraw working properly?
Posted by: Tomaaz - 02-04-2018, 09:41 PM - Forum: Linux specific - Replies (3)

The result of this code is a black screen:

Code:
set window 10, 10, 256, 256
set redraw off
for x = 0 to 255
    for y = 0 to 255
        set color x, y, 255 - x
        set pixel x, y
    next
next
redraw
wait keydown

To make it work I need to add wait 100 just before redraw. Should it work like that or is it something wrong? Notice, that wait 10 doesn't make it work properly.

Print this item

  Hidden Gem!
Posted by: makis - 02-02-2018, 06:20 PM - Forum: Questions and discussions - Replies (6)

This program deserves a wider recognition! Can you please add some more tutorials and an more in depth documentation? It has the simplicity of Blitz+ and runs perfectly on a modern machine with Windows 10.

Print this item

  Help with testing joystick input
Posted by: Marcus - 01-26-2018, 09:05 PM - Forum: Questions and discussions - Replies (3)

I don't have a joystick/gamepad that works on Linux, and therefor the joystick functions (joybutton, joyx and joyy) don't return anything but 0 yet.

Does anyone of you have a gamepad that works on Linux? If so, would you like to help me do some tests (run some programs, press some buttons on the joystick) and tell me about the results (output)?

Print this item