'---------------------------------------------------------------------
'Tree V2
'
'Steps :
'1.Draw the trunk
'2.At the end of the trunk, split by some angle and draw some branches
'3.Repeat at the end of each branch
'
'REFERENCE
'https://rosettacode.org/wiki/Fractal_tree
'---------------------------------------------------------------------
#win32
set window "Tree V2",600*screenw()/screenh(),600,false
set redraw off
'color definition
green = [0,255,0]
black = [0,0,0]
'---------------
' MAIN PROGRAM
'---------------
counter = 0
do
'clear screen
set color black ; cls
set color green
'====================================================================
'HELPME.N7
'- An attempt to make a simple syntax help/example
'- Run on windows system
'- Console mode only
'
'INSTRUCTIONS
'- Place this file in the same folder as NED.EXE
'- Compile and Run helpme.n7
'- Examples
' Help me : abs[ENTER] to see the example of absolute value
' Help me : ex3_loops[ENTER] to see the example of using loops
' Help me : dir help[ENTER] to see functions/commands in examples\help
' Help me : dir basic[ENTER] to see functions/commands in examples\basic
' Help me : exit[ENTER] to exit this HELPME.N7
'====================================================================
include "file.n7"
path = []
'Main Loop
do
write "Help me : ";temp=rln()
if lower(temp) = "exit" then end
if lower(temp) = "dir help" then system "dir examples\help\*.n7 /w"
if lower(temp) = "dir basic" then system "dir examples\basic\*.n7 /w"
if ReadAllText(path[1])=unset and ReadAllText(path[2])=unset and
temp<>"dir help" and temp<>"dir basic" then
pln "Not found"
elseif temp <> "dir"
pln
if ReadAllText(path[1])<>unset then
pln ReadAllText(path[1])
else
pln ReadAllText(path[2])
endif
endif
pln "--------------------------------------"
system "pause"
system "cls"
loop
'color wheel
'converted to N7
'https://rosettacode.org/wiki/Color_wheel#Go
#win32
set window "Color Wheel",500,500,false
set redraw off
visible tau = 2 * PI
visible r,g,b
'--------------
' main program
'--------------
set color 0,0,0; cls
colorWheel()
redraw
while not keydown(KEY_ESCAPE) fwait 60
'-----------
' functions
'------------
function hsb2rgb(hue, sat, bri)
'convert hue,saturation,brightness to RGB value
u = int(bri*255 + 0.5)
if sat = 0 then
r = u
g = u
b = u
else
h = (hue - floor(hue)) * 6
f = h - floor(h)
p = int(bri*(1-sat)*255 + 0.5)
q = int(bri*(1-sat*f)*255 + 0.5)
t = int(bri*(1-sat*(1-f))*255 + 0.5)
select int(h)
case 0
r = u; g = t; b = p
case 1
r = q; g = u; b = p
case 2
r = p ; g = u ; b = t
case 3
r = p ; g = q ; b = u
case 4
r = t ; g = p ; b = u
case 5
r = u ; g = p ; b = q
endsel
endif
endfunc
function colorWheel()
'calculate center and radius
centerX = width()/2
centerY = height()/2
radius = centerX-20
if centerY < radius then
radius = centerY-20
endif
'draw pixels for each RGB value
for y = 0 to height()
dy = (y - centerY)
for x = 0 to width()
dx = (x - centerX)
dist = sqr(dx*dx + dy*dy)
if dist <= radius then
theta = atan2(dy, dx)
hue = (theta + PI) / tau
hsb2rgb(hue, 1, 1)
Hi,
I have a question about the xform function please. In the attached example, I have a png image of 100 * 100 pixels (created in GIMP), that I am displaying on screen using the xform function with a scaling of 7. However, rather than displaying an image of 700 * 700 pixels, the image dimensions would appear to be 693 * 693 pixels? I have tried this with image files created in different applications, with the same results.
Am I maybe using the xform function incorrectly, or is there a very small issue with it? This is such a small problem that I was unsure whether to raise it, and I can work around it in my routines, so please do not rush to respond.
Added the 'draw poly xform' command (examples/help/draw_poly_xform.n7)
Added the 'draw poly image xform' command (examples/help/draw_poly_image_xform.n7)
Added support for loading music and sound effects in mp3 format
The new versions of the polygon commands let you specify position, scaling, rotation and pivot when you draw a polygon, meaning that you can use the same array of points to draw polygons all over the place.
You may reply me on weekend when you are not at work. It's not urgent
I am making an animation of a night driving with the wolf3d library.
click the images to zoom in
Could you please help me :
- I don't know how to fixed some bugs
1. the car is not turned smoothly on turn#4 and turn#3
2. the zombie animation is overlapped
- I don't know how to put the sky image as a background ( not as a tileset)
Code:
'====================================================
'
' ......
'
' Acknowlegements :
' -Haunted Night by Hot Dope
' https://pixabay.com/music/search/mood/scary/
' -Zombie
' https://opengameart.org/content/zombie-rpg-sprites
'====================================================
'----------------
' INITIALIZATION
'----------------
'#win32
set window "The Shadow", 1000,500,false
set redraw off; set mouse off
include "wolf3d.n7"
w3d = Wolf3D()
w3d.SetView(0, 0, width(primary), height(primary), rad(72))