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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 31
» Latest member: nartex
» Forum threads: 105
» Forum posts: 823

Full Statistics

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

Latest Threads
S3D : the devil's triangl...
Forum: NaaLaa 7 Questions
Last Post: 1micha.elok
7 hours ago
» Replies: 9
» Views: 105
Just for the Star Wars fa...
Forum: Everything else
Last Post: johnno56
05-05-2024, 10:40 PM
» Replies: 7
» Views: 134
Convex hull, quick algori...
Forum: NaaLaa 7 Code
Last Post: johnno56
05-04-2024, 07:23 PM
» Replies: 7
» Views: 274
Wolf3D
Forum: NaaLaa 7 Questions
Last Post: johnno56
05-02-2024, 07:57 PM
» Replies: 24
» Views: 1,380
Small pinball game using ...
Forum: NaaLaa 7 Code
Last Post: 1micha.elok
05-02-2024, 01:41 AM
» Replies: 2
» Views: 144
That 3d thing
Forum: NaaLaa 7 Code
Last Post: 1micha.elok
04-30-2024, 02:32 AM
» Replies: 14
» Views: 1,038
Raycaster
Forum: NaaLaa 6 Questions
Last Post: johnno56
04-29-2024, 09:08 AM
» Replies: 5
» Views: 248
The Maze II
Forum: NaaLaa 7 Code
Last Post: Marcus
04-28-2024, 11:53 AM
» Replies: 4
» Views: 327
Wolf3D test
Forum: NaaLaa 7 Code
Last Post: Marcus
04-27-2024, 03:05 PM
» Replies: 3
» Views: 279
The Maze
Forum: NaaLaa 7 Code
Last Post: Marcus
04-24-2024, 06:46 AM
» Replies: 15
» Views: 1,620

 
  n7 version 24.04.07 released
Posted by: Marcus - 04-07-2024, 02:13 PM - Forum: Announcements - Replies (10)

I'm taking a break from working on the s3d (simple 3d) library. It's included in this release, and now I want to see if it's possible to make a game using it. It is quite slow now, but I promise you that it will get faster when I implement better ways to do hidden surface removal and optimize all the sloppy code. I wrote some documentation for the library yesterday (S3D.pdf) and there are some examples under n7/examples/s3d_library, but you really need to have some basic knowledge about 3D programming and maybe played around with legacy OpenGL to use this thing. As I mentioned earlier, it's not meant to be a game engine - that comes later.

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

2024-04-07

  • Added the s3d library
  • Hopefully fixed an issue with the tilemap editor when running through wine

Print this item

  Tilemap Editor Linux
Posted by: johnno56 - 04-03-2024, 10:15 PM - Forum: NaaLaa 7 Questions - Replies (15)

I have found a slight problem with the TM on Linux. If you look at the GUI there is a cosmetic difference.

   

The cosmetics do not bother me... The lower 4 radio buttons cannot be selected. At the moment, it is not really an issue, as I seem to be using only the to top 3 buttons. Just to confirm the problem, I ran N7 TM in Windows 7 via Virtualbox (refer to image) and the Win7 version looked fine.

As I am only starting to work my way through the Editor, I am not requiring the use of the "angled" collision detection yet... but you never know.... Moo Ha Ha Ha...

As I stated earlier, I am not concerned about the cosmetic differences, but those lower buttons could end being an issue...

J

Print this item

  Questions about old games
Posted by: johnno56 - 03-28-2024, 11:16 PM - Forum: NaaLaa 7 Questions - Replies (28)

I was going through some old drives and noticed that I have a tendency to concentrate on "old" games... Cannot figure out why... lol

I found an old text-based Moon Lander from the late 70's... and got to thinking... (Ok. Stop laughing...) I have seen "many" versions of this game for most machines that I have owned in the past... For nostalgia, I was thinking of trying my hand at an N7 version... Which got me to thinking again... (Really. Still laughing? *sigh*)

I am pretty clear on the game elements... except for one... Collision... 

Oh. I know how to do simple AABB and Circular collisions but, when it comes to colliding with the "landscape", I am at a loss as to finding an efficient method of detection.

Most of my "programming" has been using Basic. Unless the "Basic" has a sprite collision system built in - detecting collision has been either by AABB, Circular or Colour detection. The latter would work for the "landscape" but it is SO inefficient... I cannot use AABB or Circular as the landscape is irregularly shaped...  Oh. text was SO much easier... lol

I have always enjoyed the "old stuff"... It is probably because of the way I think... (Nope. I am not going to say it...)

Any suggestions, or constructive criticisms, are always appreciated.

J

(PS: I hope that everyone will have a great and safe Easter break...)

Print this item

  Uncorrectly read file
Posted by: 1micha.elok - 03-23-2024, 11:30 AM - Forum: NaaLaa 7 Questions - Replies (6)

Question
Case 1 : I think ... [for...next] is not the best way to read text file
Case 2 : I think this is the best way, but [do..until frln(f) = "unset"] gives unexpectedly output

Please advice me what is the best way to read the whole text file ?
Thank you.

Code:
set window "readfile",400,400

f = openfile("story.txt")

'Case 1
'correctly read file
for i = 0 to 21
    wln frln(f)
    i = i + 1
next

'Case 2
'uncorrectly read file
do
    wln frln(f)
until frln(f)="unset"

free file f

temp=rln()



Attached Files
.n7   readfile.n7 (Size: 256 bytes / Downloads: 2)
.txt   story.txt (Size: 147 bytes / Downloads: 3)
Print this item

  Tiny Golf
Posted by: 1micha.elok - 03-21-2024, 01:31 PM - Forum: NaaLaa 7 Code - Replies (12)

TINY GOLF

           
click the image to zoom in
Edit : added a hole-in-one

 Description
 Help Mario to make a hole-in-one
 and achieve The World Record
 of The Tiny Golf

 Made with  
 N7_240310

 Controls :
 1. LEFT click and drag from O to aim
 2. ENTER to swing the golf club
 3. ESC to continue / quit

 Acknowledgements :
 - polygon, polyline.n7, sfx.n7 by Marcus
 - some sound effects are copied from the "Pool" game by Kevin
   hit_ball_sound, oh_no_sound
 - draggable point on a polyline by Kevin
   https://naalaa.com/forum/thread-90-post-493.html#pid493
 - sprite https://www.spriters-resource.com/game_b...eet/12294/

Code:
'-----------------------------------
' TINY GOLF
' =========
' Help Mario to make a hole-in-one
' and achieve The World Record
' of The Tiny Golf
'
' Made with N7_240310
'
' Controls :
' 1. LEFT click and drag from O to aim
' 2. ENTER to swing the golf club
' 3. ESC to continue / quit
'
' Acknowledgements :
' - polygon, polyline.n7, sfx.n7 by Marcus
' - some sound effects are copied from the "Pool" game by Kevin
'   hit_ball_sound
'   oh_no_sound
' - draggable point on a polyline by Kevin
'   https://naalaa.com/forum/thread-90-post-493.html#pid493
' - sprite https://www.spriters-resource.com/game_boy_gbc/mariogolf/sheet/12294/
'----------------------------------

'-----------------
' INITIALIZATION
'-----------------
#win32
include "assets/sound_effect.n7"
include "polyline.n7"
set window "TINY GOLF",250,180,false,3
set redraw off

'color definition
visible black_alpha = [0,0,0,24]
visible black       = [0,0,0]
visible white       = [255,255,255]
visible gray        = [150,150,150]
visible green_      = [0,80,0]
visible green       = [51,153,10,24]
visible yellow      = [200,200,0]

'cartesian coordinates
visible ox = 50,oy = 165    'origin point
axy = 360-45                'angle between x and y-axis
length = 150                'length of axis 

'Polygon
grass =
[
    ox,oy,
    length+ox,oy,
    ox+length*cos(rad(axy))+length-80 ,oy+length*sin(rad(axy)),
    ox+length*cos(rad(axy))          ,oy+length*sin(rad(axy))
]

'PolyLine Path
visible points = []
ResetPoints()
path = PolyLine(points,0)'0 = opened path
distance = 0
speed = 5

'Player
visible Player = []
Player.standby = 0
Player.face = 0
Player.swing = 0
Player.x = ox-25
Player.y = oy-30

'Sound effect
hit_ball_sound = CreateNoiseSfx(0.1, 1.05, 0, 14200)'(duration, pitch, fadeOut, sampleRate)
oh_no_sound = CreateSineSfx(1.7,600,310,0.215,11600)

'Other initial values
hit = false
drawline = false
stay = false
visible title = true
visible timer = []
timer.Start = clock()
visible i=0,j=0 'counter
visible p10,p11,p20 = ox; p21=oy
score = 50
holex = (144+224)/2
holey = 70

'------------
' MAIN LOOP
'------------
while not keydown(KEY_ESCAPE,true)
    '----------------------
    '     title screen
    '----------------------
    if title=true then Action(4,0,0)

    '----------------------
    '   screen layout
    '----------------------
    '1. golf course
    set color green; draw poly grass,1
    set color white; draw poly grass
    set caret ox,oy;wln "O"
    set color black; draw ellipse holex,holey,3,2,1
    set color white; draw ellipse holex,holey,3,2
       
    'supporting lines
    'set color yellow; draw line 0,70,width(primary),70
    'set color yellow; draw line 144,0,144,height(primary)
    'set color yellow; draw line 224,0,224,height(primary)
    'set color yellow; draw line ox,oy,holex,holey
    'set color yellow; draw line 117,0,117,height(primary)

    '3. Score
    set color white; set caret 10,40; wln "Timer"; wln round(score)
    if round(score) >= 1 then
        score = score - 0.05
    else
        free distance
        hit = false
        Say("TIME OUT..ESC")
        redraw
        play sound oh_no_sound       
        do;wait 1;until keydown(KEY_ESCAPE,true)
        ResetPoints()
        score = 50
    endif        
       
    '----------
    ' Control
    '----------
    'Left click mouse
    if mousebutton(0) then
        points[1][0] = mousex()
        points[1][1] = mousey()
       
        'use random number, wind blowing perhaps :-)
        p10 = points[1][0]+rnd(5,10)
        p11 = points[1][1]+rnd(5,10)
        drawline = true
    else
        drawline = false
    endif  

    'set how high your golf ball
    set color black_alpha; cls 'clear screen
    if drawline = true or stay then
        set color yellow
        draw line points[0][0],points[0][1],points[1][0],points[1][1]
        draw rect points[1][0] - 8, points[1][1] - 8,16,16 
        Say("ENTER to shoot")
        stay = true
    else
        Say("Drag point from O")       
    endif

    ' 2. ENTER to move ball along the PolyLine path
    if keydown(KEY_RETURN,true) then
        Action(3,0,2)
        play sound hit_ball_sound
        hit = not hit 'toggle on/off
        stay = false
    endif   
    if hit then
        points[0]=[ox,oy]
        points[1]=[p10,p11]
        points[2]=[p20,p21]
       
        'points[2] coordinate
        p20 =  p10*2
        'p21 is on a line between (ox,oy) and (holex,holey)
        'the equation of the line is y = -0.71x + 200.45
        p21 = -0.71*p20 + 200.45       
       
        path = PolyLine(points,0)'0 = opened_path
        distance = (distance + speed)%path.GetLength()
        pos = path.GetPoint(distance, 1) '1=curved
       
        draw ellipse pos[0], pos[1], 2, 2, 1 '1 = filled ellipse
       
        set caret width(primary)/2, height(primary) - 25
        set color white;draw image Player.swing,Player.x,Player.y,2 'stay at the position during the shoot

        'stop the ball and clear the remaining path's distance
        if round(distance) > 0.95*path.GetLength()then
            free distance
            hit = false
            Say("Drag square from O")
        endif
                       
        'collision detection between the ball and the hole
        '1.distance between the center of the ball and the center of the hole
        cbh = sqr(pow(holex-pos[0],2)+pow(holey-pos[1],2))
        if cbh<(2+3) then
            Say("Hole-in-one")
            PlayTune(1)
            free distance
            redraw
            hit = false
            do;wait 1;until keydown(KEY_RETURN,true) 'pause
        endif

    endif

    '-------------------------------
    ' Standy by
    '-------------------------------
    if hit=false then Action(0,0,1)
       
    redraw
    fwait 30
wend


'-----------
' FUNCTIONS
'-----------
function Action(type,cell1,cell2)
    set color white
    select type
    case 0 'stand by position
        Player.standby = loadimage("assets/standby.png",2,1)
        timer.Duration = (clock() - timer.Start)/1000
        if round(timer.Duration)%2 = 0 then
            i=cell2
        else
            i=cell1
        endif
        draw image Player.standby, Player.x, Player.y, i
    case 1 'Mario's face animation
        Player.face = loadimage("assets/say.png",3,1)
        draw image Player.face, 20,5,j
        timer.Duration = (clock() - timer.Start)/1000
        if round(timer.Duration)%2 = 0 then
            if j <= 1 then
                j = j+1
            endif
        else
            j = 0
        endif
    case 3 'swing the golf club
        for k = cell1 to cell2
            set color black
               draw rect Player.x,Player.y,width(Player.standby),height(Player.standby),1
            set color white
            Player.swing = loadimage("assets/swing.png",3,1)
            draw image Player.swing, Player.x, Player.y,k
            redraw
            wait 250
        next
        set color black; draw rect Player.x,Player.y,width(Player.standby),height(Player.standby),1
        redraw
    case 4'title screen
        title = false
        set color white
        set caret width(primary)/2,0
        center "---------"
        center "Tiny Golf"
        center "---------"
        center
        center "Help Mario"
        center "to make a hole-in-one"
        center "and achieve"
        center "The World Record"
        center "of The Tiny Golf"
        center
        center "Press ESC to continue"
        redraw
        PlayTune(1)
        do; wait 1; until keydown(KEY_ESCAPE,true)
    endsel
endfunc

'Reset draggable path points
function ResetPoints()
    points[0] = [ox,oy]
    points[1] = [ox,oy]
    points[2] = [ox,oy]
endfunc

function Say(message)
    set color green_; draw rect 0,0,width(primary),35,1 '1 = filled rectangle
    set color white; set caret width(primary)/2,15; center message

    'Mario's face
    Action(1,0,2)
    draw line 0,35,width(primary),35
endfunc



Attached Files
.zip   golf.zip (Size: 6.22 KB / Downloads: 5)
Print this item

  my third game, simple arkanoid
Posted by: aliensoldier - 03-17-2024, 03:24 PM - Forum: NaaLaa 7 Code - Replies (6)

I share with you a simplified version of arkanoid, to move use the arrows and to pause the "p" key. There are three levels and in each level the ball will move faster.

There is one thing that I have not been able to add and I was looking for how to do it but I did not find anything, I wanted to be able to control the movement of the ball, when the ball collides with the left or the right part of the edge of the player's racket I wanted the ball to If he moved in that direction with spin, like when a soccer player hits the ball with spin, I think it would have been more fun.


I put the missing file here because it won't let me put more than 5 at a time.

To start press the enter key and to start moving the ball press the space key.



Attached Files
.n7   arkanoid.n7 (Size: 6.48 KB / Downloads: 7)
.n7   player.n7 (Size: 2.06 KB / Downloads: 6)
.n7   ball.n7 (Size: 2.8 KB / Downloads: 6)
.n7   brick.n7 (Size: 1.16 KB / Downloads: 6)
.n7   list_brick.n7 (Size: 516 bytes / Downloads: 6)
.n7   miscellaneous.n7 (Size: 1.39 KB / Downloads: 6)
Print this item

  Fairy Treasure - my "first" PC game
Posted by: Marcus - 03-15-2024, 04:56 PM - Forum: Everything else - Replies (3)

This is not meant as "self promotion" or promotion for the company at which I work. I just thought someone might be interested in a game like this.

I started working at a really small game company back in ... 2006, I think. The first game I was involved with was called Fairy Treasure. I did all the programming, made all the graphics (yes, it's programmer art) and designed many of the levels. Last autumn we decided to port it to a more modern engine (SDL) and release it on Steam. And now it's on sale:

https://store.steampowered.com/app/26010..._Treasure/

It runs on Windows 10 and above and on macOS Smile

Edit This game, or the company, has got nothing to do with naalaa.

Print this item

  n7 version 24.03.10 released
Posted by: Marcus - 03-14-2024, 06:51 PM - Forum: Announcements - Replies (17)

I had planned to release this build, mostly a bug fix, last weekend. But I was in Stockholm, and then I got a really nasty cold which prevented my brain from functioning. If your programs have been crashing while you were trying to use 'draw image xform' or 'draw poly image', this should solve it.

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

2024-03-10

  • Added an awesome pool game, by Kevin, to examples/other
  • Added the polyline library with some examples
  • Fixed a bug in 'draw image xform', 'draw poly image', 'draw hraster' and 'draw vraster' that could cause a program to crash
  • Fixed a bug where calling 'gc', for forcing garbage collecting, could make some really bad stuff happen

Print this item

  Extended Simple3D version
Posted by: Marcus - 03-08-2024, 02:38 PM - Forum: NaaLaa 6 Questions - Replies (2)

Some years ago, on the old forum that went kabooom, I posted an extended version of the n6 Simple3D library. The posted version let you create and display some primitive 3d shapes (spheres, cubes, cylinders etc) and even load models in the off file format.
   Does anyone have a copy of the library I posted? Lots of code there that I don't want to rewrite for my new experiments ...

Print this item

  Off the air...
Posted by: johnno56 - 03-08-2024, 08:46 AM - Forum: Everything else - Replies (5)

I will be "off the air" from Saturday morning until Monday afternoon. Off on our annual camping break... yah... (not a fan of camping lol) Forecast temperatures for Saturday 39C, Sunday and Monday 38C... The "big three" camping issues... Flies; mosquitoes and Sunburn... I suppose it would be worse if it was hot...

Have a great weekend guys!

J

Print this item