Page 41 of 109

Posted: Thu Jan 02, 2014 8:50 pm
by Bob the Hamster
Here is what I am working on at the moment

<object width="500" height="313"><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id= ... =0"><embed src="http://vimeo.com/moogaloop.swf?clip_id= ... y=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="313"></embed></object>

I am re-using some of the scripts from Bell of Chaos for this. I wanted to work on a platformer with more traditional combat, since after re-playing Bell of Chaos, I remembered how frustrating it is to try and kill enemies.

This is still very much a work in progress.

Also, I am reminded of how much i hate doing maptiles. :P

Posted: Thu Jan 02, 2014 9:04 pm
by Meowskivich
Awesomenesssssssssssssssss

Posted: Thu Jan 02, 2014 9:30 pm
by sheamkennedy
Bob the Hamster wrote:Here is what I am working on at the moment
That's so awesome! How did you do the parallax? Is it just a background slice that moves along with the screen focus as the maptiles slide by?

Posted: Fri Jan 03, 2014 4:44 am
by Bob the Hamster
Thanks!

I designated map layer 0 and 1 to be parallax layers on every map.

When the map first loads, I loop through the maptiles and find the bottom-most right-most non-zero tile. I use that to calculate how big the parallax layer will be.

Then in my script that runs every tick to update the camera, I get the slice handles for those two map layers and adjust their x and y position based on the camera position.

Here is the script that I use to detect the size of a parallax layer

Code: Select all

script, get parallax size, para, layer, begin
  variable&#40;x, y, tile, found, fy&#41;
  found &#58;= false
  for&#40;y, map height -- 1, 0, -1&#41; do&#40;
    for&#40;x, 0, map width -- 1&#41; do&#40;
      tile &#58;= read map block&#40;x, y, layer&#41;
      if&#40;tile <> 0&#41; then&#40;
        fy &#58;= y
        set slice height&#40;para, &#40;y + 1&#41; * 20&#41;
        found &#58;= true
        break
      &#41;
    &#41;
    if&#40;found&#41; then&#40;break&#41;
  &#41;
  found &#58;= false
  for&#40;x, map width -- 1, 0, -1&#41; do&#40;
    for&#40;y, 0, fy&#41; do&#40;
      tile &#58;= read map block&#40;x, y, layer&#41;
      if&#40;tile <> 0&#41; then&#40;
        set slice width&#40;para, &#40;x + 1&#41; * 20&#41;
        found &#58;= true
        break
      &#41;
    &#41;
    if&#40;found&#41; then&#40;break&#41;
  &#41;
end
I store the size in the width and height of an invisible slice container.

here is the camera updating script:

Code: Select all

script, update camera, sl, begin
  variable&#40;x, y&#41;
  x &#58;= slice edge x&#40;sl, edge&#58;center&#41;
  y &#58;= slice edge y&#40;sl, edge&#58;bottom&#41; -- 20
  put camera&#40;x -- 160, y -- 100&#41;
  # Update parallax layers
  variable&#40;i, layer, para, layer sl, mapw, maph, screenw, screenh&#41;
  screenw &#58;= slice width&#40;sprite layer&#41;
  screenh &#58;= slice height&#40;sprite layer&#41;
  for&#40;i, 0, 1&#41; do&#40;
    para &#58;= slice child&#40;parallaxen, i&#41;
    if&#40;i == 0&#41;      then&#40;layer sl &#58;= lookup slice&#40;sl&#58;map layer 0&#41;&#41;
    else if&#40;i == 1&#41; then&#40;layer sl &#58;= lookup slice&#40;sl&#58;map layer 1&#41;&#41;
    mapw &#58;= map width * 20
    maph &#58;= map height * 20
    set slice x&#40;layer sl, &#40;camera pixel x  * &#40;mapw -- slice width&#40;para&#41;&#41; / large&#40;1, mapw -- screenw&#41;&#41;&#41;
    set slice y&#40;layer sl, &#40;camera pixel y  * &#40;maph -- slice height&#40;para&#41;&#41; / large&#40;1, maph -- screenh&#41;&#41;&#41;
  &#41;
end
Note that if you wanted to do this just for one map, and didn't mind hard-coding the size of the parallax layers, you could eliminate the first script entirely, and make the second script noticeably simpler.

Posted: Sat Jan 04, 2014 1:04 pm
by TMC
sheamkennedy wrote:After watching some inspiring videos I decided to go for a much more minimal graphical style. It's taking me way less time to draw maptiles now and I think it's surprisingly better looking than what I was doing prior to this. Thoughts?
While I like these new graphics, I did prefer the previous ones, because I really liked the details. However, if you can draw these much faster than the previous ones and that leads to greater variety, then I suppose that for me personally the net effect will be better.
Bob the Hamster wrote:Here is what I am working on at the moment
Cool; I know that I can look forward to this.

The high walking speed and animation is the most noticeable thing for me. At least I thought it reminded me of Super Metroid, but I see its mechanics are a bit different. Actually, the walking animation doesn't match the walking speed (which I'm sure is actually very common), and that's why it stuck out at me.
Bob the Hamster wrote:Here is the script that I use to detect the size of a parallax layer
You can use "break(2)" to jump out of two nested loops. "continue(x)" also works. (Previously I even allowed jumping out of a variable number of loops, but since realised what a terrible idea that was). Also, I'm amused to see that your script is resolution independent.

Posted: Sat Jan 04, 2014 2:03 pm
by Bob the Hamster
TMC wrote:
Bob the Hamster wrote:Here is the script that I use to detect the size of a parallax layer
You can use "break(2)" to jump out of two nested loops. "continue(x)" also works. (Previously I even allowed jumping out of a variable number of loops, but since realised what a terrible idea that was). Also, I'm amused to see that your script is resolution independent.
Oh, awesome! This feature is undocumented. I remember wondering if that feature existed, but after examining the entries in the plotscripting dictionary, decided it didn't.

The walking speed is probably a little too high right now, but it is nice for getting around while I am debugging things but have not implemented save/load yet.

I'll probably lower the default walking speed a bit, but add some kind of Boots of Speed equipable item for faster movement. I might even draw separate running animation sprites

Don't hold out any hope for getting the walking animation to synch with actual movement speed. If that happens it will just be luck :)

Posted: Sat Jan 04, 2014 4:42 pm
by TMC
Opps.

I think that acceleration in platformers work well when you don't notice it, because there is a separate "starting to run" "animation" (which might just be differing frame times). Which implies that accelerating to full speed takes only the length of the animation, usually a few ticks. Sonic is the only commercial platformer I can think of where your character looks like its sliding around.

Posted: Wed Jan 08, 2014 12:45 pm
by Sparoku
Maybe there should be a "show off your scripts" thread. XD

Posted: Wed Jan 08, 2014 1:07 pm
by BMR
SparElric wrote:Maybe there should be a "show off your scripts" thread. XD
That's not a bad idea actually.

Posted: Thu Jan 09, 2014 5:05 am
by Bob the Hamster
<object width="500" height="313"><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id= ... =0"><embed src="http://vimeo.com/moogaloop.swf?clip_id= ... y=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="313"></embed></object>

I love making enemy ai. I think it is probably my favorite thing about this project so far.

Making those damn ladder-ramps work correctly? My least favorite thing. Thank goodness they are done, and I shouldn't have to mess with them anymore!

Posted: Thu Jan 09, 2014 5:58 am
by Meowskivich
Bob the Hamster wrote:<object width="500" height="313"><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id= ... =0"><embed src="http://vimeo.com/moogaloop.swf?clip_id= ... y=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="313"></embed></object>

I love making enemy ai. I think it is probably my favorite thing about this project so far.

Making those damn ladder-ramps work correctly? My least favorite thing. Thank goodness they are done, and I shouldn't have to mess with them anymore!
Shootin' petals, reminds me of those flowers from Yoshi's Island (which I used to know the names of, but I forget. I guess I'll look next time I play Tetris Attack)

Posted: Thu Jan 09, 2014 10:38 am
by Sparoku
BMR wrote:
SparElric wrote:Maybe there should be a "show off your scripts" thread. XD
That's not a bad idea actually.
Thanks! ^.^
Meowskivich wrote:Shootin' petals, reminds me of those flowers from Yoshi's Island (which I used to know the names of, but I forget. I guess I'll look next time I play Tetris Attack)
Piranha plant? :???:

EDIT: Oh wait! Do you mean those flowers with the yellow balls for petals that Yoshi can eat and make eggs out of?! :D

Posted: Thu Jan 09, 2014 6:14 pm
by Meowskivich

Posted: Thu Jan 09, 2014 9:20 pm
by sheamkennedy

Posted: Thu Jan 09, 2014 11:43 pm
by Bob the Hamster