Where to find scrolling background examples?

Find quick help here to get you started with Hollywood
Post Reply
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Where to find scrolling background examples?

Post by amyren »

Is there an example code somewhere of usage of scrolling background, like for usage in a jump and run type of game.
Or where should I look in the manual to learn about this?
plouf
Posts: 462
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Where to find scrolling background examples?

Post by plouf »

i think the command DisplayBGPicPart or displaybrushpart is what you are lookng just load longer picture and display a shifted image every time
Christos
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Where to find scrolling background examples?

Post by airsoftsoftwair »

plouf wrote: Fri Nov 27, 2020 2:48 pm i think the command DisplayBGPicPart or displaybrushpart is what you are lookng just load longer picture and display a shifted image every time
Jump'n'run games usually compose the background by combining a set of small tiles. Scrolling is then achieved by offsetting the tiles.
User avatar
Juan Carlos
Posts: 884
Joined: Mon Sep 06, 2010 1:02 pm

Re: Where to find scrolling background examples?

Post by Juan Carlos »

amyren wrote: Fri Nov 27, 2020 9:07 am Is there an example code somewhere of usage of scrolling background, like for usage in a jump and run type of game.
Or where should I look in the manual to learn about this?
The only example that I have seen to do this is the Boing Ball against SubZero and the demo Game is slow, because Hollywood can'ts mover background, sprites, read the las to mover the SubZero, I think that Hollywood is not the ideal programing language to make games like jump and run, shoot, plataform, cars, etc.
Bugala
Posts: 1168
Joined: Sun Feb 14, 2010 7:11 pm

Re: Where to find scrolling background examples?

Post by Bugala »

There are different ways to achieve scrolling, and while Juan Carlos is right that Hollywood isnt ideal for jump n runs, I however see no reason not to use Hollywood for that, since there isnt anything inherently problematic either.

That thing is, if you are making scrolling for Classic Amigas, then forget about Hollywood, it is simply too heavy to be used. But then again, Hollywood isnt really ideal for anything Amiga Classics, since Hollywood is aimed at more powerful machines.

You could compare this to Java. If you plan on making a game for Classic Amigas, you dont use Java for that, since that would be terrible choice for Classic Amigas, since Java is meant to be used by heavily powered machines. Theres nothing inherently wrong with Java (or Hollywood) it is just that they are not aimed at Classic Amigas.

That explained, Hollywood can handle Jump n run just like other heavy powered machine aimed languages can. As long as you have a heavy powered machine, it works just fine.

Also, if you need faster scrolling for some reason, you can use for example SDL library commands to not use Hollywood own systems but SDL system then, hence making Hollywood sort of becoming the ideal language for jump n run games (just like any other SDL etc. supporting languages).


I am telling you here two examples on how to make scrolling.

First one is to make a very big brush. Lets say you have 320x200 screen. You could make then 640x200 sized brush.

If you display this brush at location 0,0, then you will see only first 320 pixels. display it at location 1,0, and you will see pixels 1 - 321. And this way by keeping showing 1 more pixel each time, it will look like it is scrolling.

Basically this is bit clumsy way of achieving scrolling, since supposing you want to make Super Mario Bros 1 first level, you will need in this examples case maybe 6400 x 200 sized brush, which means it needs quite much memory. However, modern machines have whole load of memory, so while this had been out of question on Amiga 500 times, this is quite doable nowadays.


To have something bit similar is to use this and tiles approach.

You could have for example 352 x 200 sized brush. I picked this size based upon that you would basically be using 32x32 pixel tiles on 320x200 screen.

Idea is that first you use those tiles to make that brush.

you would have table telling what tiles at what point come. as example:

Code: Select all

mariolevel1 = { 
				[0] = {0, 0, 1, 2, 1, 0, 0...}
				[1] = {1, 2, 0, 0, 3, 0, 0...}
				[2]...
				}
				
Idea being that this is x and y co-ordinate. the [0] being x, and rest numbers being y.

using this info you know which tile to put on that brush to where.

for example tile number 0 would be put to location 0,0, and tile numbr 0 would come to location 32,0 as well, then tile number 1 to location 64,0...

Now this big brush would be shown on one of locations 0,0 to 32,0.

If after location 32,0 location becomes bigger (as in 33), then big brush would be shown at location 0,0 again. However, big brush would be updated by taking tiles from one further to the right, or in this case, leaving the lines first numbers out, which would be 0 and 1 in this example table [0] and [1] lines first numbers.

this way it would look like screen is scrolling forward and instead of needing 6400x200 brush, you survive with just 352x200 brush.

similarly if big brush is at location 0,0, and it is supposed to move left (as in -1,0) then big brush jumps to 32,0 location and brush is updated by getting one more numbers from left side, in this case includin 0 and 1 again from [0] and [1] tables.
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: Where to find scrolling background examples?

Post by amyren »

Thanks for the replies.
I will try DisplayBGPicPart first, since it was easier for me to understand.
All those tiles confuse me a bit :lol:
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Where to find scrolling background examples?

Post by SamuraiCrow »

amyren wrote: Mon Nov 30, 2020 6:46 pm All those tiles confuse me a bit :lol:
For an editor and example pictures, see https://www.mapeditor.org/. Tiled should work on your Mac already. Then just use the Lua exporter to make the tables.
I'm on registered MorphOS using FlowStudio.
User avatar
Juan Carlos
Posts: 884
Joined: Mon Sep 06, 2010 1:02 pm

Re: Where to find scrolling background examples?

Post by Juan Carlos »

amyren wrote: Mon Nov 30, 2020 6:46 pm Thanks for the replies.
I will try DisplayBGPicPart first, since it was easier for me to understand.
All those tiles confuse me a bit :lol:
There is a easy and simple Mario example made with Hollywood, I don't remember the author.
jalih
Posts: 276
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: Where to find scrolling background examples?

Post by jalih »

Here is an early christmas present... Download tilemap sample and start scrolling those tilemaps... ;)

test.hws - Shows how to setup draw object, load tilemap data, setup viewport object and how to draw and move tilemap.

maped.hws - Simple tilemap editor. Load tiles image, setup tilemap and paint tiles. Use cursor keys to scroll map and mouse wheel to scroll tile palette. Finished map can be saved to file and saved files can naturally be opened later on.

Example tileset and tilemap is located inside data directory.

Code should handle the most tilemap functionality. You can even make the viewport bounce around the screen as you scroll your tilemap... :lol:

I have only old version of Hollywood, so I hope it still works...
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: Where to find scrolling background examples?

Post by amyren »

Thank you. I will check it out :)
Post Reply