[REQUEST]How to add and pan images through a script ...

Started by Calintz, October 15, 2009, 07:25:30 am

Previous topic - Next topic

Calintz

Dear Chaos Project members,

I was hoping that somebody would be so kind as to create an in-depth tutorial on how to show images in a window using the script editor, and how to pan those images as well. These features are often seen in animated title screens, menus, etc...

Thank you in advance ...

legacyblade

I don't know much about how to do this, myself. But I'd take a look at the game intro script Blizz wrote for the BlizzABS demo. It creates and moves images all over the place.

Calintz

That's just the thing ...
I know of several scripts that utilize this feature that I could look into and try to put two and two together, but I grasp things quicker if I'm not running all over the place wondering if this code here is part of the process, or that code there, you know??

If I'm told exactly what does what in pure layman's terms, then I can adapt very well and begin to memorize the code very easily. I found this out by reading through one of Mr. Mo's window tutorials. By extensively reviewing and forcing the information into my head, I can create windows, show pictures, and animate them from scratch.

However, I don't know how to pan, because that was not part of the tutorial. Therefore, I didn't learn it ...

winkio

to draw a picture: use Bitmap.blt
to move a picture: erase where the image is and draw it somewhere else.

To get the code for all of this: go into RMXP, hit F1, search for Bitmap, and hit the first item that appears.

Calintz

But how would that pan the picture constantly. I want it to pan indefinitely, not just relocate ...

Aqua

There are many ways... they all include loops.

PSEUDO-CODE :D
loop do
unless x > 150
Bitmap.blt(x, y, w, h, Rect)
x += 5
else
break


This would move the picture 5 pixels to the right every frame.
Unless I'm really off with my coding... O.o

winkio


while x < 150
Bitmap.clear
Bitmap.blt(x, y, w, h, Rect)
x += 5
end


needed the .clear

and don't use do when you can use while.

Calintz

This may be stupid, but what's the distinct difference between do and while??

Blizzard

do-while loops will execute the loop at least once since the first checking of the condition is at the end. while loops can end up not being executed at all since the condition is checked right at the beginning and naturally it won't execute even one iteration if the condition isn't fulfilled.

It's not stupid. It's, in fact, a question that is asked often.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Calintz


Blizzard

Not really. As I said, they just differ in their concepts a bit. If you need the code in a loop to be executed at least once, you use do-while, otherwise you use while.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

right, which is why if you only need while, don't use a do-while.

Calintz

Okay ...
I think I understand.

I will see what I can come with using these methods.