Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 37
» Latest member: Ludwig
» Forum threads: 203
» Forum posts: 1,542
Full Statistics
|
Online Users |
There are currently 107 online users. » 0 Member(s) | 106 Guest(s) Bing
|
|
|
Question about snake game |
Posted by: aliensoldier - 07-19-2024, 05:48 PM - Forum: NaaLaa 7 Questions
- Replies (11)
|
 |
I have a question about the snake game. The snake's body is divided into small pieces and they follow the head. How can I make the pieces that make up the body follow the head of the snake when I move it?
|
|
|
Animated String Art |
Posted by: johnno56 - 07-11-2024, 08:36 PM - Forum: NaaLaa 7 Code
- Replies (4)
|
 |
Not sure if I had posted this before... If I have, let me know, and I will delete it... lol
This is a converted QB64 demo created by BPlus...
If you are as old or older than I am then this will be a "flash back"... If you are young, then stare continuously at the rotating pattern, then transfer all your savings to the following account number... Moo Ha Ha Ha Ha....
Variable "t" on line #41 will determine the number of "points" to be drawn. The program will start with one point and increment by one until "t" is reached. Then it starts over again using a different colour... ESC to quit.
Code: ' Open a window and enable double buffering.
set window "String Art Animated", 600, 600, false
set redraw off
' Converted from a QB64 program by BPlus
randomize clock()
visible xmax = 600
visible ymax = 600
visible a1, a2, cx, cy, r, s, n, pi, t
visible red, blue, green
r = ymax / 2
cx = xmax / 2
cy = ymax / 2
n = 250
s = 360 / n
red = 175
green = 255
blue = 255
pi = 3.141592654
t = 1
do
set color 0, 0, 0
cls
'set color red, green, blue
draw ellipse cx - 1, cy, r, r
for i = 1 to n
a1 = s * i
a2 = s * i * t
set color red, green , blue
draw line cx + sin(d2r(a1)) * r, cy + cos(d2r(a1)) * r, cx + sin(d2r(a2)) * r, cy + cos(d2r(a2)) * r
next
t = t + 0.0125
if t >= 20
t = 1
red = 32 + rnd(33, 255)
green = 32 + rnd(33, 255)
blue = 32 + rnd(33, 255)
endif
redraw
fwait 60
until keydown(KEY_ESCAPE, true)
' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function d2r(angle)
return angle * (pi / 180)
endfunc
' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
|
N7 version 24.06.29 released |
Posted by: Marcus - 06-29-2024, 03:31 PM - Forum: Announcements
- Replies (3)
|
 |
This release contains a first version of the enginea library, meant for sector based first person shooter games. This is far from the final version of the library; support for meshes is very basic and has not been tested much.
https://naalaa.com/n7/N7_240629.zip
2024-06-29 - Added the enginea library and editor (enginea_editor.exe), for sector based first person shooter games, plus a tutorial (EngineA_Tutorial.pdf) and examples in examples/enginea_library
|
|
|
Confused about mid() command |
Posted by: johnno56 - 06-11-2024, 01:39 AM - Forum: NaaLaa 7 Questions
- Replies (7)
|
 |
Hi Marcus,
I was tinkering with string manipulation and came across a bit of a 'poser' in regards to the mid() command.
Here is a short example....
Code: ' Open a window and enable double buffering.
set window "Test", 800, 632, false
set redraw off
visible a = "ABCDEF"
visible b
visible c
' display the letters "B" to "E" inclusive...
b = mid(a, 1, 4)
pln b
' This works fine...
' But, when I try to make the third letter "D"
' an "X"...
' mid(b, 3, 1) = "X"
' pln b
' I get a syntax error on line 17 during compile
'(remove the "remarks" from lines 17 and 18
' to see what I mean...)
system "pause"
Defining a string then assigning a variable to a "portion" of the string, using mid(), works fine...
But, trying to replace a character, using mid() causes the compilation to fail with a syntax error.
There is no rush on this one... Whenever you are able... Present situation understood... We will "keep an eye on the store" during your break...
J
|
|
|
|