A tutorial that shows you how to make a working camera in your game (one that takes a snapshot of your map).

Just as it sound, an actual Camera Tutorial. You actually get to take the picture from where you want to take it.

So before starting this tutorial you'll need:

- A really cool and nice map

- A really cool picture of the map

- Me and my tutorial

- Rm2k and some programming skills

Any questions, no? Lets go on. Basically we'll be getting the hero coordinates, we'll substract them from the middle screen points (160-x, 120-y) and we'll add half the width and the height of the map. If you didn't get that it doesn't really matter.

1. STARTING EVENT

Create a Switch called Camera. Create a Common Event, Parallel Process, if S - "Camera" is On. Create a variable called Password and type an Enter Password with a check on Descision and Wait until Key Hit. Now to finish, create a Fork Option saying variable Password equals 5. It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

: End Case

<>

"You just opened an action command, so if you press the action key while the Camera switch is On you'll do the following operation."

2. SETTING VARIABLES

Create a variable called Map ID. "The Map ID will let you determine which map are you on."

Create two variables called Camera X and Camera Y. "These variables will carry half the map length and height"

Create two variables called Hero X and Hero Y. "These variables will carry the Hero Coordinates."

Create two variables called Temp X and Temp Y. "These variables are temporaries which'll carry the whole equation.

Create a Fork Option saying variable Map ID equals 1. If it does then variable Camera X will equal half Map 1's Width and variable Camera Y will equal half Map 1's Height. Set variable Hero X to Hero X Pos and set variable Hero Y to Hero Y Pos. Multiply both of these by 16. Add 16 to variable Hero X and add 8 to variable Hero Y. "What you just did will give the Hero its actual pixel coordinates." Finally set Temp X to 160 and set Temp Y to 120. It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

<>Fork Optn: Varbl[0002:Map ID]-1

<>Variable Ch: [0003:Camera X]Set, ? ("1/2 the width")

<>Variable Ch: [0004:Camera Y]Set, ? ("1/2 the height")

<>

: End Case

<>Variable Ch: [0005:Hero X]Set, Hero X Pos

<>Variable Ch: [0006:Hero Y]Set, Hero Y Pos

<>Variable Ch: [0005:Hero X]*, 16

<>Variable Ch: [0006:Hero Y]*, 16

<>Variable Ch: [0005:Hero X]+, 16

<>Variable Ch: [0006:Hero Y]+, 8

<>Variable Ch: [0007:Temp X]Set, 160

<>Variable Ch: [0008:Temp Y]Set, 120

<>

: End Case

<>

"If you're doing fine continue but if you aren't you should better stop now."

3. THE EQUATION

Create two variables called Picture X and Picture Y. "The variables where you'll show the picture."

Substract variable Hero X from variable Temp X. Substract variable Hero Y from variable Temp Y. Add variable Camera X to variable Temp X and add variable Camera Y to Temp Y. Finally, set variable Picture X to Temp X and set variable Picture Y to Temp Y. It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

<>Fork Optn: Varbl[0002:Map ID]-1

<>Variable Ch: [0003:Camera X]Set, ? ("1/2 the width")

<>Variable Ch: [0004:Camera Y]Set, ? ("1/2 the height")

<>

: End Case

<>Variable Ch: [0005:Hero X]Set, Hero X Pos

<>Variable Ch: [0006:Hero Y]Set, Hero Y Pos

<>Variable Ch: [0005:Hero X]*, 16

<>Variable Ch: [0006:Hero Y]*, 16

<>Variable Ch: [0005:Hero X]+, 16

<>Variable Ch: [0006:Hero Y]+, 8

<>Variable Ch: [0007:Temp X]Set, 160

<>Variable Ch: [0008:Temp Y]Set, 120

<>Variable Ch: [0007:Temp X]-, Var. [0005]val. (Hero X)

<>Variable Ch: [0008:Temp Y]-, Var. [0006]val. (Hero Y)

<>Variable Ch: [0007:Temp X]+, Var. [0003]val. (Cam. X)

<>Variable Ch: [0008:Temp Y]+, Var. [0004]val. (Cam. Y)

<>Variable Ch: [0009:Pic X]Set, Var. [0007]val. (Temp X)

<>Variable Ch: [0010:Pic Y]Set, Var. [0008]val. (Temp Y)

<>

: End Case

<>

"That basically covers the Camera Tutorial but there's some stuff that still has to be done"

4. SETTING BOUNDARIES

Find out what the minimun and maximun ranges are for your map. You should have four of these: A Minimum X Range, a Maximun X Range; a Minimun Y Range and a Maximun Y Range. "These will vary not only because of the map size but also if you have a picture frame, but once you've got them do the following."

Create a Fork Option saying variable Map ID equals 1. If so:

Create a Fork Option for if variable Pic X is below the Pic X Minimun Range. If so set variable Pic X to variable Pic X Minimun Range.

Create a Fork Option for if variable Pic X is above the Pic X Maximun Range. If so set variable Pic X to variable Pic X Maximun Range.

Create a Fork Option for if variable Pic Y is below the Pic Y Minimun Range. If so set variable Pic Y to variable Pic Y Minimun Range.

Create a Fork Option for if variable Pic Y is above the Pic Y Maximun Range. If so set variable Pic Y to variable Pic Y Maximun Range.

It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

<>Fork Optn: Varbl[0002:Map ID]-1

<>Variable Ch: [0003:Camera X]Set, ? ("1/2 the width")

<>Variable Ch: [0004:Camera Y]Set, ? ("1/2 the height")

<>

: End Case

<>Variable Ch: [0005:Hero X]Set, Hero X Pos

<>Variable Ch: [0006:Hero Y]Set, Hero Y Pos

<>Variable Ch: [0005:Hero X]*, 16

<>Variable Ch: [0006:Hero Y]*, 16

<>Variable Ch: [0005:Hero X]+, 16

<>Variable Ch: [0006:Hero Y]+, 8

<>Variable Ch: [0007:Temp X]Set, 160

<>Variable Ch: [0008:Temp Y]Set, 120

<>Variable Ch: [0007:Temp X]-, Var. [0005]val. (Hero X)

<>Variable Ch: [0008:Temp Y]-, Var. [0006]val. (Hero Y)

<>Variable Ch: [0007:Temp X]+, Var. [0003]val. (Cam. X)

<>Variable Ch: [0008:Temp Y]+, Var. [0004]val. (Cam. Y)

<>Variable Ch: [0009:Pic X]Set, Var. [0007]val. (Temp X)

<>Variable Ch: [0010:Pic Y]Set, Var. [0008]val. (Temp Y)

<>Fork Optn: Varbl[0002:Map ID]-1

<>Fork Optn: Varbl[0009:Pic X]-? Less

<>Variable Ch: [0009:Pic X]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0009:Pic X]-? Above

<>Variable Ch: [0009:Pic X]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0010:Pic Y]-? Less

<>Variable Ch: [0010:Pic Y]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0010:Pic Y]-? Above

<>Variable Ch: [0010:Pic X]Set, ?

<>

: End Case

<>

: End Case

<>

: End Case

<>

"I know that seemed like a mess and besides, the ranges are kinda hard to get, but you need them if you don't want just a piece of map in the picture."

5. FINAL TOUCHES

Show a Battle Animation on the Hero and wait. Show Picture 1 - "The Map" and set it to the Picture variables. Show Picture 2 - "Frame" and set it to 160, 120. Wait 1s and Erase both pictures. It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

<>Fork Optn: Varbl[0002:Map ID]-1

<>Variable Ch: [0003:Camera X]Set, ? ("1/2 the width")

<>Variable Ch: [0004:Camera Y]Set, ? ("1/2 the height")

<>

: End Case

<>Variable Ch: [0005:Hero X]Set, Hero X Pos

<>Variable Ch: [0006:Hero Y]Set, Hero Y Pos

<>Variable Ch: [0005:Hero X]*, 16

<>Variable Ch: [0006:Hero Y]*, 16

<>Variable Ch: [0005:Hero X]+, 16

<>Variable Ch: [0006:Hero Y]+, 8

<>Variable Ch: [0007:Temp X]Set, 160

<>Variable Ch: [0008:Temp Y]Set, 120

<>Variable Ch: [0007:Temp X]-, Var. [0005]val. (Hero X)

<>Variable Ch: [0008:Temp Y]-, Var. [0006]val. (Hero Y)

<>Variable Ch: [0007:Temp X]+, Var. [0003]val. (Cam. X)

<>Variable Ch: [0008:Temp Y]+, Var. [0004]val. (Cam. Y)

<>Variable Ch: [0009:Pic X]Set, Var. [0007]val. (Temp X)

<>Variable Ch: [0010:Pic Y]Set, Var. [0008]val. (Temp Y)

<>Fork Optn: Varbl[0002:Map ID]-1

<>Fork Optn: Varbl[0009:Pic X]-? Less

<>Variable Ch: [0009:Pic X]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0009:Pic X]-? Above

<>Variable Ch: [0009:Pic X]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0010:Pic Y]-? Less

<>Variable Ch: [0010:Pic Y]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0010:Pic Y]-? Above

<>Variable Ch: [0010:Pic X]Set, ?

<>

: End Case

<>

: End Case

<>Show Battle Anim: Snap!, Hero (W)

<>Show Picture: 1, Map, (V[0009], V[0010])

<>Show Picture: 2, Frame, (160, 120)

<>Wait 1.0s.

<>Erase Picture: 1

<>Erase Picture: 2

<>

: End Case

<>

And there it is, your own Camera Tutorial! If you're like dumb and didn't got a thing I said visit my web and download this tutorial into Rm2k.

http://home.graffiti.net/mooglemaster/games.htm

Oh yeah, sorry if it has lots of typos or bad grammar but I did it at 1 o' clock in the morning.

Enjoy it!

So before starting this tutorial you'll need:

- A really cool and nice map

- A really cool picture of the map

- Me and my tutorial

- Rm2k and some programming skills

Any questions, no? Lets go on. Basically we'll be getting the hero coordinates, we'll substract them from the middle screen points (160-x, 120-y) and we'll add half the width and the height of the map. If you didn't get that it doesn't really matter.

1. STARTING EVENT

Create a Switch called Camera. Create a Common Event, Parallel Process, if S - "Camera" is On. Create a variable called Password and type an Enter Password with a check on Descision and Wait until Key Hit. Now to finish, create a Fork Option saying variable Password equals 5. It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

: End Case

<>

"You just opened an action command, so if you press the action key while the Camera switch is On you'll do the following operation."

2. SETTING VARIABLES

Create a variable called Map ID. "The Map ID will let you determine which map are you on."

Create two variables called Camera X and Camera Y. "These variables will carry half the map length and height"

Create two variables called Hero X and Hero Y. "These variables will carry the Hero Coordinates."

Create two variables called Temp X and Temp Y. "These variables are temporaries which'll carry the whole equation.

Create a Fork Option saying variable Map ID equals 1. If it does then variable Camera X will equal half Map 1's Width and variable Camera Y will equal half Map 1's Height. Set variable Hero X to Hero X Pos and set variable Hero Y to Hero Y Pos. Multiply both of these by 16. Add 16 to variable Hero X and add 8 to variable Hero Y. "What you just did will give the Hero its actual pixel coordinates." Finally set Temp X to 160 and set Temp Y to 120. It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

<>Fork Optn: Varbl[0002:Map ID]-1

<>Variable Ch: [0003:Camera X]Set, ? ("1/2 the width")

<>Variable Ch: [0004:Camera Y]Set, ? ("1/2 the height")

<>

: End Case

<>Variable Ch: [0005:Hero X]Set, Hero X Pos

<>Variable Ch: [0006:Hero Y]Set, Hero Y Pos

<>Variable Ch: [0005:Hero X]*, 16

<>Variable Ch: [0006:Hero Y]*, 16

<>Variable Ch: [0005:Hero X]+, 16

<>Variable Ch: [0006:Hero Y]+, 8

<>Variable Ch: [0007:Temp X]Set, 160

<>Variable Ch: [0008:Temp Y]Set, 120

<>

: End Case

<>

"If you're doing fine continue but if you aren't you should better stop now."

3. THE EQUATION

Create two variables called Picture X and Picture Y. "The variables where you'll show the picture."

Substract variable Hero X from variable Temp X. Substract variable Hero Y from variable Temp Y. Add variable Camera X to variable Temp X and add variable Camera Y to Temp Y. Finally, set variable Picture X to Temp X and set variable Picture Y to Temp Y. It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

<>Fork Optn: Varbl[0002:Map ID]-1

<>Variable Ch: [0003:Camera X]Set, ? ("1/2 the width")

<>Variable Ch: [0004:Camera Y]Set, ? ("1/2 the height")

<>

: End Case

<>Variable Ch: [0005:Hero X]Set, Hero X Pos

<>Variable Ch: [0006:Hero Y]Set, Hero Y Pos

<>Variable Ch: [0005:Hero X]*, 16

<>Variable Ch: [0006:Hero Y]*, 16

<>Variable Ch: [0005:Hero X]+, 16

<>Variable Ch: [0006:Hero Y]+, 8

<>Variable Ch: [0007:Temp X]Set, 160

<>Variable Ch: [0008:Temp Y]Set, 120

<>Variable Ch: [0007:Temp X]-, Var. [0005]val. (Hero X)

<>Variable Ch: [0008:Temp Y]-, Var. [0006]val. (Hero Y)

<>Variable Ch: [0007:Temp X]+, Var. [0003]val. (Cam. X)

<>Variable Ch: [0008:Temp Y]+, Var. [0004]val. (Cam. Y)

<>Variable Ch: [0009:Pic X]Set, Var. [0007]val. (Temp X)

<>Variable Ch: [0010:Pic Y]Set, Var. [0008]val. (Temp Y)

<>

: End Case

<>

"That basically covers the Camera Tutorial but there's some stuff that still has to be done"

4. SETTING BOUNDARIES

Find out what the minimun and maximun ranges are for your map. You should have four of these: A Minimum X Range, a Maximun X Range; a Minimun Y Range and a Maximun Y Range. "These will vary not only because of the map size but also if you have a picture frame, but once you've got them do the following."

Create a Fork Option saying variable Map ID equals 1. If so:

Create a Fork Option for if variable Pic X is below the Pic X Minimun Range. If so set variable Pic X to variable Pic X Minimun Range.

Create a Fork Option for if variable Pic X is above the Pic X Maximun Range. If so set variable Pic X to variable Pic X Maximun Range.

Create a Fork Option for if variable Pic Y is below the Pic Y Minimun Range. If so set variable Pic Y to variable Pic Y Minimun Range.

Create a Fork Option for if variable Pic Y is above the Pic Y Maximun Range. If so set variable Pic Y to variable Pic Y Maximun Range.

It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

<>Fork Optn: Varbl[0002:Map ID]-1

<>Variable Ch: [0003:Camera X]Set, ? ("1/2 the width")

<>Variable Ch: [0004:Camera Y]Set, ? ("1/2 the height")

<>

: End Case

<>Variable Ch: [0005:Hero X]Set, Hero X Pos

<>Variable Ch: [0006:Hero Y]Set, Hero Y Pos

<>Variable Ch: [0005:Hero X]*, 16

<>Variable Ch: [0006:Hero Y]*, 16

<>Variable Ch: [0005:Hero X]+, 16

<>Variable Ch: [0006:Hero Y]+, 8

<>Variable Ch: [0007:Temp X]Set, 160

<>Variable Ch: [0008:Temp Y]Set, 120

<>Variable Ch: [0007:Temp X]-, Var. [0005]val. (Hero X)

<>Variable Ch: [0008:Temp Y]-, Var. [0006]val. (Hero Y)

<>Variable Ch: [0007:Temp X]+, Var. [0003]val. (Cam. X)

<>Variable Ch: [0008:Temp Y]+, Var. [0004]val. (Cam. Y)

<>Variable Ch: [0009:Pic X]Set, Var. [0007]val. (Temp X)

<>Variable Ch: [0010:Pic Y]Set, Var. [0008]val. (Temp Y)

<>Fork Optn: Varbl[0002:Map ID]-1

<>Fork Optn: Varbl[0009:Pic X]-? Less

<>Variable Ch: [0009:Pic X]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0009:Pic X]-? Above

<>Variable Ch: [0009:Pic X]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0010:Pic Y]-? Less

<>Variable Ch: [0010:Pic Y]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0010:Pic Y]-? Above

<>Variable Ch: [0010:Pic X]Set, ?

<>

: End Case

<>

: End Case

<>

: End Case

<>

"I know that seemed like a mess and besides, the ranges are kinda hard to get, but you need them if you don't want just a piece of map in the picture."

5. FINAL TOUCHES

Show a Battle Animation on the Hero and wait. Show Picture 1 - "The Map" and set it to the Picture variables. Show Picture 2 - "Frame" and set it to 160, 120. Wait 1s and Erase both pictures. It should be looking like this.

<>Enter Password: [0001:Password]

<>Fork Optn: Varbl[0001:Password]-5

<>Fork Optn: Varbl[0002:Map ID]-1

<>Variable Ch: [0003:Camera X]Set, ? ("1/2 the width")

<>Variable Ch: [0004:Camera Y]Set, ? ("1/2 the height")

<>

: End Case

<>Variable Ch: [0005:Hero X]Set, Hero X Pos

<>Variable Ch: [0006:Hero Y]Set, Hero Y Pos

<>Variable Ch: [0005:Hero X]*, 16

<>Variable Ch: [0006:Hero Y]*, 16

<>Variable Ch: [0005:Hero X]+, 16

<>Variable Ch: [0006:Hero Y]+, 8

<>Variable Ch: [0007:Temp X]Set, 160

<>Variable Ch: [0008:Temp Y]Set, 120

<>Variable Ch: [0007:Temp X]-, Var. [0005]val. (Hero X)

<>Variable Ch: [0008:Temp Y]-, Var. [0006]val. (Hero Y)

<>Variable Ch: [0007:Temp X]+, Var. [0003]val. (Cam. X)

<>Variable Ch: [0008:Temp Y]+, Var. [0004]val. (Cam. Y)

<>Variable Ch: [0009:Pic X]Set, Var. [0007]val. (Temp X)

<>Variable Ch: [0010:Pic Y]Set, Var. [0008]val. (Temp Y)

<>Fork Optn: Varbl[0002:Map ID]-1

<>Fork Optn: Varbl[0009:Pic X]-? Less

<>Variable Ch: [0009:Pic X]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0009:Pic X]-? Above

<>Variable Ch: [0009:Pic X]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0010:Pic Y]-? Less

<>Variable Ch: [0010:Pic Y]Set, ?

<>

: End Case

<>Fork Optn: Varbl[0010:Pic Y]-? Above

<>Variable Ch: [0010:Pic X]Set, ?

<>

: End Case

<>

: End Case

<>Show Battle Anim: Snap!, Hero (W)

<>Show Picture: 1, Map, (V[0009], V[0010])

<>Show Picture: 2, Frame, (160, 120)

<>Wait 1.0s.

<>Erase Picture: 1

<>Erase Picture: 2

<>

: End Case

<>

And there it is, your own Camera Tutorial! If you're like dumb and didn't got a thing I said visit my web and download this tutorial into Rm2k.

http://home.graffiti.net/mooglemaster/games.htm

Oh yeah, sorry if it has lots of typos or bad grammar but I did it at 1 o' clock in the morning.

Enjoy it!