Post new topic    
Metal Slime
Send private message
Looking for Slice Example 
 PostFri Sep 12, 2014 6:45 pm
Send private message Reply with quote
Hello! Smile

I searched the ohr-wiki to find an exaple how to show slices on the screen, but I couldn't find the article about slices.
I a looking for a really simple example, so I can experiment with build on it to learn how use slices.

Should you know where to find an article or simple example, please let me know here.
Thanks! Grin
Liquid Metal King Slime
Send private message
 
 PostFri Sep 12, 2014 7:26 pm
Send private message Reply with quote
Have you read this? http://rpg.hamsterrepublic.com/ohrrpgce/Slices_Tutorial

The search feature built into the wiki is pretty terrible. Whenever I can't remember the name of a wiki article, I go to google and search something like "ohrrpgce slice example"

You might also want to read this article http://rpg.hamsterrepublic.com/ohrrpgce/Scripts:Large_sprites which is a relatively simple example of slice usage.

If neither of those suit your purposes, it might help to know what you want to do with slices, since that would help me decide which direction to send you (or maybe myself or someone else can write up a simple example that fits your needs)
Metal Slime
Send private message
 
 PostFri Sep 12, 2014 7:54 pm
Send private message Reply with quote
Thanks for the links. .)

The first tutorial, I read it some time ago. I think it's not easy to understand.
If it were a shoe I'd say it just dosen't fit, I can't get along with this tutorial, somehow. :/

The example script is seems a bit to complex.

How about an example just to show a slice on the screen and one to delete it ?
Liquid Metal King Slime
Send private message
 
 PostFri Sep 12, 2014 9:03 pm
Send private message Reply with quote
Code:
plotscript, show a monster and then remove it, begin
  variable(sl)
  sl := load medium enemy sprite(0)
  wait(20)
  free slice(sl)
end


This example loads the first medium enemy sprite as a slice. It will be in the top left corner of the screen. After 20 ticks, it will be removed

Let me know if you have any questions about what each command in the script means, and when you understand it, we can move on to a slightly more advanced example
Metal Slime
Send private message
 
 PostSat Sep 13, 2014 10:16 pm
Send private message Reply with quote
Thanks for the example, Bob!
Together with BMR's tutorial I could makea usefull amount of sense of the example. Grin

Still, I have one question about how slices are handeled in the engin:
Do I have to put the slice I want to use in the slice collection first? Or can it take the images from the graphics menu?

My goal is to make an easy-animated intro for a game.
So I'd like to move slices across the screen and swap them while doing so.
I haven't written a script yet ( and I haven't drawn the sprites either).
I'll just write my thoughts about how I'd try to do this and maybe you could tell me if I'm on the wrong path?

Slices move by pixel, so i'd need a for-loop to move them across the screen in a straight line, right?
I guess moving them in shape of a curve or something is to much math for an easy try.
Also, I guess I'd have to use a slice container to keep track of the x-y-value, because I'd need to remove the slice that is shown on the screen, before(?) replacing it with another slice.

When i feel more awake i'll try to post a script.
Metal King Slime
Send private message
 
 PostSun Sep 14, 2014 9:00 am
Send private message Reply with quote
marionline wrote:

Do I have to put the slice I want to use in the slice collection first? Or can it take the images from the graphics menu?


You don't need to use the slice collection editor. It makes certain things easier, and a lot of folks prefer using it over scripting everything. I've never used it for anything major myself. I know how it works, and how to use it, but I just prefer scripting everything instead. If you want to give it a shot, you can tinker with it. I'll be covering it in part 3 of my tutorial, but that won't be for another week or so as I'm only writing these tutorial things over the weekends.


marionline wrote:
My goal is to make an easy-animated intro for a game.
So I'd like to move slices across the screen and swap them while doing so.


Certainly very doable, and also pretty easy to do Smile



marionline wrote:
Slices move by pixel, so i'd need a for-loop to move them across the screen in a straight line, right?


You could, but move slice by would probably be better suited for this.



marionline wrote:
I guess moving them in shape of a curve or something is to much math for an easy try.


I wrote something to do bezier curves. You pretty much just plug in the start and end coordinates and it'll curve its way there. I can clean up the script and give it to you if you want.



marionline wrote:
Also, I guess I'd have to use a slice container to keep track of the x-y-value, because I'd need to remove the slice that is shown on the screen, before(?) replacing it with another slice.


Well, you can get the x/y value of any slice with slice x and slice y, so you wouldn't need to make a container for it. You could make a container for everything else though, so it'll be easy to free everything up when you're done.

Also, if you want to replace the slice, you could just use one of the replace commands. If you were using a big enemy sprite, for example, you could just use replace large enemy sprite to switch the image with another. That way, you don't need to create another slice and worry about having another handle to take care of. Using the replace thing, it'll keep the same handle and still be where you left it.
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Display posts from previous: