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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 30
» Latest member: Technopeasant
» Forum threads: 92
» Forum posts: 704

Full Statistics

Online Users
There are currently 82 online users.
» 1 Member(s) | 80 Guest(s)
Bing, johnno56

Latest Threads
Pixeli Lander Test
Forum: NaaLaa 7 Code
Last Post: johnno56
Less than 1 minute ago
» Replies: 2
» Views: 14
Pixel Color Test
Forum: NaaLaa 7 Questions
Last Post: johnno56
Yesterday, 12:07 PM
» Replies: 5
» Views: 112
n7 version 24.04.14 relea...
Forum: Announcements
Last Post: Marcus
Yesterday, 10:28 AM
» Replies: 0
» Views: 23
The Maze
Forum: NaaLaa 7 Code
Last Post: johnno56
Yesterday, 03:17 AM
» Replies: 10
» Views: 295
n7 version 24.04.07 relea...
Forum: Announcements
Last Post: 1micha.elok
Yesterday, 12:09 AM
» Replies: 10
» Views: 308
pursuing object
Forum: NaaLaa 7 Questions
Last Post: Marcus
04-11-2024, 08:18 PM
» Replies: 3
» Views: 92
Pixel Collision
Forum: NaaLaa 7 Questions
Last Post: johnno56
04-11-2024, 09:30 AM
» Replies: 11
» Views: 326
N6 Lander
Forum: NaaLaa 7 Code
Last Post: 1micha.elok
04-10-2024, 02:46 AM
» Replies: 1
» Views: 65
Tilemap Editor Linux
Forum: NaaLaa 7 Questions
Last Post: johnno56
04-07-2024, 07:49 PM
» Replies: 15
» Views: 806
Questions about old games
Forum: NaaLaa 7 Questions
Last Post: johnno56
04-02-2024, 06:13 PM
» Replies: 28
» Views: 2,042

 
  Pixeli Lander Test
Posted by: johnno56 - 9 hours ago - Forum: NaaLaa 7 Code - Replies (2)

Ok. This is a VERY crude Lander test. It uses "pixeli()" for collision with the Landing Pad and normal AABB for the ground...

I would appreciate an examination of how I have implemented the pixeli command and suggest any and all corrections.

Note: The ship can land from beneath the pad... Not an error. The landing pad (except for a concept level) is always on the ground.

The usual controls: Arrow keys.
Note: BOTH landing struts MUST contact the pad.
Watch your landing velocity.


.zip   pixelTest.zip (Size: 70.7 KB / Downloads: 2)

Print this item

  n7 version 24.04.14 released
Posted by: Marcus - Yesterday, 10:28 AM - Forum: Announcements - No Replies

You can now use 'pixeli(x, y)' or 'pixeli(image_id, x, y)' to get the color of an image's pixel as a single number. You can also use 'set colori' to set the current drawing color using such a number.

If you need to convert RGB or RGBA values to a single number color, you can use functions like these:

Code:
function ToRGB(r, g, b)
    return 255*16777216 + r*65536 + g*256 + b
endfunc

function ToRGBA(r, g, b, a)
    return a*16777216 + r*65536 + g*256 + b
endfunc
 
And to get the RGBA components of a single number color:

Code:
function Alpha(c)
    return int(c/16777216)
endfunc

function Red(c)
    return int((c/65536))%256
endfunc

function Green(c)
    return int((c/256))%256
endfunc

function Blue(c)
    return c%256
endfunc

2024-04-14
Added the 'pixeli' function and 'set colori' command to get and set colors as single numbers

Print this item

  Pixel Color Test
Posted by: johnno56 - 04-11-2024, 08:27 PM - Forum: NaaLaa 7 Questions - Replies (5)

Marcus,

I am still confused in regards to "how" the pixel() command works.

Are you able to explain the output produced? (see attached image)

   

Regards

J

Print this item

  pursuing object
Posted by: aliensoldier - 04-11-2024, 01:51 PM - Forum: NaaLaa 7 Questions - Replies (3)

A question, if I have two objects and one is the player who can move with the keys and the other is the enemy who is stationary in one place on the screen.

The question would be how can I make it so that when the player is close to the enemy he starts chasing the player and if the player moves away the enemy stops chasing him and returns to the starting position.

Print this item

  N6 Lander
Posted by: johnno56 - 04-09-2024, 10:52 PM - Forum: NaaLaa 7 Code - Replies (1)

With all this discussion about Lunar Lander stuff, why not go back to the source, and recreate the original N6 Lander using N7?

Warning: Docking can be a little flaky and keep your eye on that fuel level...


.zip   landerN6.zip (Size: 6.76 KB / Downloads: 4)

ps: Look familiar, Marcus? Wink

Print this item

  The Maze
Posted by: 1micha.elok - 04-09-2024, 09:50 AM - Forum: NaaLaa 7 Code - Replies (10)

THE MAZE
I'm still working on the game, and soon it will be released
Herewith some preview snapshots :

           
click the image to zoom in

Big Grin Big Grin Big Grin

Print this item

  Pixel Collision
Posted by: johnno56 - 04-09-2024, 09:08 AM - Forum: NaaLaa 7 Questions - Replies (11)

I figured that I might try some 'old school' collision detection...

The concept is... A falling box. An area to land on. Using the 'pixel()' command, instruct the box to stop, as it "hits" the ground.

In this example, I am testing the pixel below the box's left bottom edge. (I have placed a reference pixel under the box at the same "y" co-ordinate.)

Press SPACE to drop...

Code:
' Open a window and enable double buffering.
set window "Pixel Collision", 640, 480
set redraw off

visible Box = [255, 255, 0, 64]
visible BoxW = 32
visible BoxH = 48
visible BoxX = (width(primary) - BoxW) / 2
visible BoxY = 0
visible vSpeed = 0
visible drop = false

visible ground = [0, 255, 0]

do

    set color 0, 0, 0
    cls
   
    Update()
    Draw()
   
    redraw
    fwait 30
   
until keydown(KEY_ESCAPE, true)

function Update()
    '   vSpeed
    if keydown(KEY_SPACE, true)     drop = true
    if drop = true  vSpeed = vSpeed + 0.03
   
    '   Box
    BoxY = BoxY + vSpeed
   
    '   Pixel Collision
    if pixel(BoxX, BoxY + BoxH) = ground
        vSpeed = 0
    endif
   
    '   Just in case 'pixel' fails... lol
    if BoxY > height(primary)
        vSpeed = 0
        wait 1000
        end
    endif
endfunc

function Draw()
    '   Ground
    set color ground
    draw rect 0, 460, 640, 20, 0
   
    '   Box
    set color Box
    draw rect BoxX, BoxY, BoxW, BoxH, 0
   
    '   Pixel
   
    '   This indicator pixel is drawn one pixel below the box center.
    '   The actual pixel being tested is below the left corner of the box.
    set color 255, 0, 255
    draw pixel BoxX + 15, BoxY + BoxH
endfunc

Unfortunately this did not work... "Read the manual", I hear you say... "pixel(x,y) Returns the color at position (x, y) as an array [r, g, b, a] with RGBA intensities in the range [0 .. 255].

I am hoping that my programing skills are the source of the problem otherwise this maybe another "can of worms".... sorry...

Print this item

  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