Lua Sprite Mega Tutorial v2.5 (Parts I-XX)

zardOz2 - Custom level - from Android
PlayEdit60 players liked this.Log in to like this level.


Part I: this:draw_sprite() basics
Very detailed description of the nine values of the this:draw_sprite() command.

Part II: this:set_draw_tint() basics, angles, sizing and input variables with RC control.

Part III: this:set_draw_z() basics, controlling draw depth, and some basic predetermined movement.

Part IV: this:set_sprite_texel() basics, this:set_sprite_filtering() basics, sprite sheet basics.

Part V: More Complex sprites, setting texels in bulk with for/do loops: basics, raw input and math.ceil

Part VI: setting texels in bulk with double for/do loops: basics, this:first run and memory optimization basics.

Part VII: Two-dimensional color scaling basics, reusing a pattern..

Part VIII: TechZ style Sprite stacking basics and stack color scaling.

Part IX: Basic sprite shaping by controlling alpha.

Part X: Complex mathmatical texel patterns and color shading

Part XI: Mirror imaging basics.

Part XII: Pattern making basics, Understanding tables/arrays basics.

Part XIII: Using Mirror Imaging to your advantage. Value1%Value2 "remainder" basics.

Part XIV: Calling for sections of a sprite sheet pattern as needed. Graphical counter displays and looping.

Part XV: Basic 4 direction movement control and Variable setting.

Part XVI: Basic 4-direction collision detection, with get_bbox, get_position.

Part XVII: Simulating realistic motion and gravity basics.

Part XVIII: Circular motion basics, calculating the X and Y positions on a curve.

Part XIX: Simulating realistic curved motion and gravity(swing), line draw basics.

Part XX: My version of Jammer312's 3d rotating sprite, advanced counter looping.

Whew 20 parts! All done, except for any minor fixes, this is lagging pretty bad for me. I'll probably do a smaller Line Draw tutorial in this style and maybe some new parts tutorials...stay tuned.

Any feedback from lua noobs on if this is helpful would be great!

Be prepared to read and play test!

Views: 8916 Downloads: 3995 Unique objects: 12 Total objects: 148

Discuss this level

Log in to comment on this level.
  • JOELwindows7: Dear zardOz at heaven!
  • nalcwap: @zardOz. Have any documentation explain this? Thanks
  • leo_wulf: @zardOz: oh really? :D that's impressive
  • zardOz2: @leo_wulf: leo, i had zero programming skills last december all I know I learned by making levels
  • leo_wulf: @zardOz: this lua stuff makes the game far away from my skills ...I hope players would like the apparatus style too
  • Technomancer: @zardOz: ooo ok
  • zardOz2: @Sdac: @Pajlada: Im having trouble making my Luas forget their texel settings, even if I remove the set texel lines entirely from the code. Im samsung M930, happens on this level on all of the pattern codes..
  • zardOz2: @Technomancer: you can use the "sprite vs walls" or just write many "draw_sprite" lines one for each wall.
  • Technomancer: @zardOz: i mean like the one you make on your spooky dungeon theres many walls
  • Technomancer: @zardOz: ok
  • zardOz2: @Technomancer: im not sure what you mean... See "sprite vs walls"
  • Technomancer: @zardOz: can you tell me how to make multiple walls?
  • Aceheliflyer: I dont get any lag.
  • zardOz2: @Technomancer: thx T!
  • Technomancer: @zardOz: this is awesome!!!!
  • ElementalGenius98: @zardOz: thx ^^
  • zardOz2: @ElementalGenius98: this:read_frequency()
  • ElementalGenius98: I mean in lua :o
  • ElementalGenius98: @zardOz: How could we manage to get more than 4 inputs? :o
  • zardOz2: @Technomancer: raycast will only make an x/y if if strikes something,you could draw a wall but there wil be an object there
  • WXWMC: @zardOz: thanks a lot!:-D
  • zardOz2: @WXWMC: oops;)
  • WXWMC: i'm trying to learn lua so I beg you to allow derivatives.:'(
  • Technomancer: @zardOz: is it possible that we can use raycast to make a x and y value and make that x and y value to be a wall code?
  • Technomancer: @zardOz: ooooo
  • zardOz2: @Technomancer: i ussually skip them
  • Technomancer: @zardOz: are you in for the contest?
  • zardOz2: @ElementalGenius98: lua school has about 30 of the "part equivilent" codes
  • zardOz2: @ElementalGenius98: ahh, see "lua school basics", "Super Sine Wave", "Arbitrary waveform generator", "4x looping fifo", also I put many of the basic codes for things like "and gates" in the wiki object description.
  • ElementalGenius98: @zardOz: I mean gates in lua :) how to programm a sine wave timer sequenzer and gate and so far :)
  • zardOz2: And thx;)
  • zardOz2: @ElementalGenius98: gates? Ive done about 60 tutorials and helps on gates and other parts lol..
  • ElementalGenius98: @zardOz: this is sooo AWESOME! *_* After youve finished your lua graphic project you have to make an tutorial series for gates and such things to ^^
    Weaponed with these 2 you can easily get an pro in lua scripting ^^
  • zardOz2: Brazil just offered Tim Howard the Presidency if he defects!
  • zardOz2: @Technomancer: thx T, glad to help:)
  • JOELwindows7: @WXWMC: that was cool new featuring hovercraft carry.
  • WXWMC: @JOELwindows7: thanks,i was building THE BLUEPRINTS V0.7 when you sent me the message.and check out my new goods lifter.:-)
  • JOELwindows7: @WXWMC: look here, the x1 and y2 set to that object position. Edit and see
  • Technomancer: @zardOz: thanks to you now we have many lua scripter :D
  • PeterZ: @zardOz: oh...
  • zardOz2: @PeterZ: Anything that is rotated increases the complexity by about 40x.
  • PeterZ: Oh, it requires different code for each surface?
  • zardOz2: @PeterZ: any knid of surface will require a large complex code... which I havent mastered yet... anyway its too complex for this tutorial. Next im gonna add part of my 6-walls super bouncy ball code.
  • PeterZ: Maybe sprite that will bounce off any kind of surface?
  • PeterZ: @pajlada: so theoretically yes, practically hard
  • pajlada: @PeterZ: that's fully dependant on how you fill up the texel, in 1.4 you can only use a texel map that's 128x128 pixels, so it's hard to get smooth lines
  • PeterZ: @pajlada: yes, and I understand that you can just manage to do that just by placing "sprite pixels" where they need to bee, but can you make it as smooth as rotated square. By the way I have only some idea of how does LUA work.
  • pajlada: @PeterZ: Do you mean a sprite that isn't represented as a quadrilateral? i.e. has "multiple corners", like a deformed circle
  • PeterZ: @pajlada: example - you have spilled motor oil on you white sheet, can you represent it in sprite form, and not going the same way as making that solider.
  • pajlada: @PeterZ: What's a shapeless sprite?
  • PeterZ: @zardOz:@pajlada: is it possible to draw shapeless sprite?
  • pajlada: @zardOz: not that I can think of right now, no
  • zardOz2: @pajlada: thanks p, can you think of any of the basics I might have forgot?
  • pajlada: Very nice :)
  • Technomancer: @zardOz: ooooo ok
  • zardOz2: @Technomancer: I want to make this for other languagues, I need help, translate programs are terrible.
  • Technomancer: @zardOz: you mean?
  • zardOz2: @Technomancer: Thx, Im still looking for insane people to translate my very wordy tutorials into other languages... This one is a good candidate.
  • Technomancer: @zardOz: thanks zardOz this is very helping
  • zardOz2: @wokstation: I take my "mega" very seriously;) one stop shopping! @andrew: I know what you mean, I started appartus 3 weeks before Principia, I almost didnt play because of the learning curve... I knew nothing about programing 6 months ago... but once you get the hang of If/then and for/do then you can really start making some interesting things... thx, glad you like it!
  • andrew: This is mind blowing for me, I had apparatus's electronics under control, but principia blew me away. I'm a mechanical person. But this is amazing.
  • wokstation22: This is getting immense! The "mega" in the title is deserved. Nice work, and thank you!
  • biweevil: More than enough
  • zardOz2: @biweevil: @jasnsathome: @epicperson99369: @TechZ: Thanks All! 13 should be enough to keep folks busy for now.
  • epicperson99369: @TechZ: thanks!! And I subscribed too!!
  • jasnsathome: As usual excellent job. Great presentation and cool concepts.
  • TechZ2124: @epicperson99369: Have a look to my level "3D LUA SPRITE" to have a look to the code. Bawically you "stack" a lot of flat sprite to make the illusion of a 3D sprite. And awesome tutorial @zardOz: !
  • epicperson99369: Can you teach us how to make a 3D sprite?
  • biweevil: Thank you
  • JOELwindows7: @zardOz: yea bro, that would be Awesome!
  • zardOz2: @JOELwindows7: thx joel... patterns coming up
  • JOELwindows7: Mega! Awesome!
  • zardOz2: @PeterZ: Thx again, Why am I half-unpacking?
  • zardOz2: @Alfajim: thanks! It's tough with so many non-english folks, also I have to ccover all of the other stuff like (first run) assuming the reader knows nothing.
  • Alfajim: Superb! Really great tutorials. Your explanations are very clearly written. Thank you and keep up the good work. : )
  • PeterZ: Wow! I love the 8# you might want to use half-unpack - MAX for it,
  • zardOz2: @ElementalGenius98: heh, well I still have a lot to learn so It may never be final:) and thx!
  • ElementalGenius98: @zardOz: gettin bigger and better ^^ can't wait for it's final Form :)
  • zardOz2: @PeterZ: thx Pete!
  • PeterZ: Nice :)

LEVEL ID: 8313