Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Marcus

Pages: [1] 2 3 ... 29
Code snippets / Re: Mandala Rock Painting
« on: September 30, 2017 »
Beautiful :)

Thanks for all your programs, Rick. I'll include lots of your stuff in the next update if you don't mind :)

Code snippets / Super plasma moving things
« on: September 23, 2017 »
Trying to mimic a screen saver I've seen on mac. Looks like beams, but it's particles following moving cubic Bezier curves.

Code: [Select]
import "ifx.lib"
import "Speed.lib"

W 800
H 600
HW# 400.0
HH# 300.0



randomize 3

create image 1, 31, 31
set image 1
set color 0, 0, 0
for y = 0 to 30;
dy# = float(y - 15)
dysqr# = dy*dy
for x = 0 to 30
dx# = float(x - 15)
d# = sqr(dx*dx + dysqr)
if d < 15.0
c = int(32.0*(1.0 - d/15.0))
set color c, c, c
set pixel x, y
set image primary

set window (screenw() - W)/2, (screenh() - H)/2, W, H
set redraw off

if not IFX_Init() then end

for i = 0 to sizeof(curves) - 1
_InitCurve curves[i]

for i = 0 to sizeof(particles) - 1
particles[i].c = -1

tick = 0
tick = tick + 1
for i = 0 to sizeof(curves) - 1
_UpdateCurve curves[i]
if tick%6 = i
_AddParticle i

last = sizeof(particles) - 1
for i = 0 to last
if particles[i].c >= 0
particles[i].p# = particles[i].p# + 0.00225
if particles[i].p# > 1.0
particles[i].c = -1

set color 0, 0, 0, 16; cls
_IFX_Blur 16

_SPD_HoldFrame 60
until keydown(27, true)

procedure InitCurve(&curve?)
curve.x0# = HW
curve.y0# = HH
curve.d1# = 100.0 + float(rnd(300))
curve.a1# = float(rnd(360))
curve.x1# = HW + cos(curve.a1#)*curve.d1#
curve.y1# = HH + sin(curve.a1#)*curve.d1#
curve.s1# = float(rnd(100) - 50)*0.02
curve.d2# = 300.0 + float(rnd(300))
curve.a2# = float(rnd(360))
curve.x2# = HW + cos(curve.a2#)*curve.d2#
curve.y2# = HH + sin(curve.a2#)*curve.d2#
curve.s2# = float(rnd(100) - 50)*0.02
curve.d3# = 300.0 + float(rnd(300))
curve.a3# = float(rnd(360))
curve.x3# = HW + cos(curve.a3#)*curve.d3#
curve.y3# = HH + sin(curve.a3#)*curve.d3#
curve.s3# = float(rnd(100) - 50)*0.02

procedure UpdateCurve(&curve?)
curve.a1# = curve.a1# + curve.s1#
curve.x1# = HW + cos(curve.a1#)*curve.d1#
curve.y1# = HH + sin(curve.a1#)*curve.d1#
curve.a2# = curve.a2# + curve.s2#
curve.x2# = HW + cos(curve.a2#)*curve.d2#
curve.y2# = HH + sin(curve.a2#)*curve.d2#
curve.a3# = curve.a3# + curve.s3#
curve.x3# = HW + cos(curve.a3#)*curve.d3#
curve.y3# = HH + sin(curve.a3#)*curve.d3#

procedure EvaluateCurve(&curve?, p#, &x#, &y#)
ip# = 1.0 - p
a# = ip*ip*ip
b# = 3.0*ip*ip*p
c# = 3.0*ip*p*p
d# = p*p*p
x = a*curve.x0# + b*curve.x1# + c*curve.x2# + d*curve.x3#
y = a*curve.y0# + b*curve.y1# + c*curve.y2# + d*curve.y3#

' debug.
procedure PlotCurve(&curve?, points)
step# = 1.0/float(points)
p# = 0.0
x#; y#
for i = 0 to points - 1
_EvaluateCurve curve, p, x, y
set pixel int(x), int(y)
p = p + step

procedure AddParticle(index)
last = sizeof(particles) -1
for i = 0 to last
if particles[i].c < 0 then break
if i <= last
particles[i].c = index
particles[i].p# = 0.0

procedure DrawParticles()
last = sizeof(particles) - 1
set additive true
for i = 0 to last
if particles[i].c >= 0
alpha = int((1.0 - particles[i].p#)*255.0)
set color 64, 128, 255, alpha
x#; y#
_EvaluateCurve curves[particles[i].c], particles[i].p#, x, y
'draw pixel int(x), int(y)
draw image 1, int(x), int(y)

General discussion / Re: Requiring NaaLaa Tutorials
« on: September 08, 2017 »
Yeah, the built in examples and the stuff that you can find on this forum is it, I'm afraid. But if there's anything you want an example of, just make a post and I'll put something together :) Even if you asked something big like "How do I make a Super Mario Bro's clone?", I'd happily respond with code examples quickly :)

Also, most of the games at come with full sourcecode, but they might be too complex to start with.

Libraries / Re: GLOOM, a new raycaster library
« on: August 03, 2017 »
Aye, just set the last parameter for GLOOM_SetFog to 0 :)  Just trying to make it look retro:er with that fog effect.

Libraries / Re: GLOOM, a new raycaster library
« on: July 29, 2017 »
Ah, good :)  Usually strafing left and right, by holding down Z, makes distant enemies easier to hit. But I'll add some options for tweaking the controls later. I wanna make 12 levels before I'm done with this game :)

Libraries / Re: GLOOM, a new raycaster library
« on: July 28, 2017 »
Here's the first area (four levels) of the game. I've added some music and sound effects, and you can now also use the arrow keys to move (the title screen explains the controls). There's even a boss at the last level, but you still can't die, so ... :)

I forgot to mention on the title screen, that you can HOLD the TAB key to show a map.

Yeah, someone reported negative time() values. I guess that could happen if your computer had been turned on for very long. Naalaa only supports signed integers, and as C's timegettime returns a DWORD (an unsigned int) some weird stuff could occur. I've fixed it and it'll be in the next update, that will be released within two weeks (finishing up the GLOOM library).

Showcase / Re: Music Keyboard
« on: July 24, 2017 »
I'm going to the No-Internet land for a week, but hopefully I'll be able to download it through my phone, looks interesting!

Oh god, I've missed some threads :D

The function time() works just like timeGetTime in Windows (C++) and returns the time elapsed since Windows started :)

In the next update I'll change it to return the time that's passed since the program started instead, makes more sense (atleast for me).

Yeah, I've seen it quite often, just haven't had the time to fix it. Usually happens when you have just two files open and close the leftmost tab. An update is coming and I promise to fix the issue :)

Sorry, there's no built in way to deal with that :( Usually I only use text for displaying score and information with pretty well known length that I can split up in forhand. But here's a simple procedure you can try:

Code: [Select]
create font 0, "courier new", 28

text$ = "Hello there, this is a really long and interesting text that "
text = text + "will hopefully span over multiple rows. My uncle used "
text = text + "to write really long texts, but they weren't that funny."

_PrintLong text
wait keydown

procedure PrintLong(txt$)
if fwidth(0, txt) >= width(primary)
index = 0
while fwidth(0, left(txt, index)) < width(primary)
index = index + 1
wln left(txt, index - 1)
txt = right(txt, index - 1)
wln txt

If you need a more generic way to word-wrap text at a certain x position and with a certain width I could probably write some more advanced function.

Libraries / Re: GLOOM, a new raycaster library
« on: July 03, 2017 »
Looking good . Those zombies are a little hard to stop. I don't know if its me or this key board.
 I tend to get overrun. Maybe it needs an easy level . (or bigger guns). An option to use the arrow keys would be nice.

Yeah, the first zombie type should be easier. I'll remove the run-at-ya part from it and save it for the second type. Bigger guns will come too. I can add the option to use Wolfenstein 3D controls (no mouse, just arrow keys for movement).

Libraries / Re: GLOOM, a new raycaster library
« on: July 02, 2017 »
Just another level for Zombie Tumult, nothing's changed in the library. Won't post more until I have a fun game :)

Libraries / Re: GLOOM, a new raycaster library
« on: June 28, 2017 »
Nice !  :)
Is it possible to detect the type of keyboard with Naalaa?
I ask this because WASD controls works fine with a QWERTY keyboard but not AZERTY ;)

I totally didn't know there were other types of keyboard layouts :D  For WASD control, you can just let W and Z, and A and Q, do the same thing. I'll fix that for this game. There's no way to detect what type of keyboard the user has in naalaa, and I couldn't find a simple solution to it from some quick google searches.

Libraries / Re: GLOOM, a new raycaster library
« on: June 24, 2017 »
The library feels pretty complete (atleast for my needs) now, but the editor may need some more work. I've fixed some bugs and started working on a "game", Zombie Tumult, which is included in the zip. The game uses mouse and AWSD control. You can shoot some zombies, but they won't harm you yet :)

Pages: [1] 2 3 ... 29