English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 18 March 2011, 16:12   #1
r0ber7
it's all in your head
 
r0ber7's Avatar
 
Join Date: Feb 2011
Location: The Netherlands
Posts: 174
Coding my game in Blitz2

I've started coding a game in Blitz Basic 2. This is my very first Blitz program, so I'm still getting used to how things are done.

So, I have a question:

I've pixeld a little red wizard. Now I'd want to make it walk on the screen with the keyboard. The walking (and jumping) animations look like this:



My problem: how do I load the image into memory and make it walk around?

I think I should LoadShape a brush, then blit it on screen?

Last edited by r0ber7; 18 March 2011 at 17:13.
r0ber7 is offline  
Old 18 March 2011, 17:36   #2
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
From memory you need to create a shape using an external program (try aminet, or SHED in the archive I upped),and then blit it as you say. I cannot remember off the top of my head, it's a bit hazy..

Check through that stuff I upped
BippyM is offline  
Old 18 March 2011, 18:07   #3
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Okay I have had another look (I actually loaded Blitz ) and you do need to create shapes, then you simply blitz them

There is an example in the examples directory that blits some basic shapes. It also creates a Slice which is basically a screen!

The slice format is

Code:
Slice  [Slice#,Y,Flags]|[Slice#,Y,Width,Hite,Flgs,Bitplns,Sprts,Colrs,Fscrnw,Bscrnw]
Have a look in the examples dir, there is a bit there.
BippyM is offline  
Old 18 March 2011, 18:14   #4
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Quote:
Originally Posted by r0ber7 View Post
I've pixeld a little red wizard. Now I'd want to make it walk on the screen with the keyboard. The walking (and jumping) animations look like this:



Cool wizard pixel art


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 21 March 2011, 17:41   #5
r0ber7
it's all in your head
 
r0ber7's Avatar
 
Join Date: Feb 2011
Location: The Netherlands
Posts: 174
Quote:
Originally Posted by bippym View Post
Okay I have had another look (I actually loaded Blitz ) and you do need to create shapes, then you simply blitz them

There is an example in the examples directory that blits some basic shapes. It also creates a Slice which is basically a screen!

The slice format is

Code:
Slice  [Slice#,Y,Flags]|[Slice#,Y,Width,Hite,Flgs,Bitplns,Sprts,Colrs,Fscrnw,Bscrnw]
Have a look in the examples dir, there is a bit there.
Thanks, this helped me a lot.

I'm now trying to set up a 320x256 slice with 256 colours. Is this even possible? Or should I edit my images?
When not run in Blitz mode, 256 colour bitmap + shapes blitted on it works perfectly, but in Blitz mode it tells me "too many bitplanes to load". Perhaps blitz mode is not for AGA? I'm considering not making it an AGA game...

The idea is to have an animated shape (smoking wizard) on a bitmap (home.iff).

Quote:
Originally Posted by Lonewolf10 View Post
Cool wizard pixel art


Regards,
Lonewolf10
Thanks, here's another:


Last edited by r0ber7; 21 March 2011 at 18:11.
r0ber7 is offline  
Old 21 March 2011, 17:46   #6
TCD
HOL/FTP busy bee

 
TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,679
Quote:
Originally Posted by r0ber7 View Post
Thanks, here's another:

Really like your style Keep it up
TCD is offline  
Old 21 March 2011, 18:16   #7
Djay
95th User
 
Djay's Avatar
 
Join Date: May 2001
Location: Brighton/UK
Age: 48
Posts: 3,120
nice... what kinda game is it... platform adventure?
Djay is offline  
Old 21 March 2011, 18:25   #8
Kitty
Registered User
 
Kitty's Avatar
 
Join Date: Mar 2005
Location: London UK
Posts: 1,532
this is nice
Kitty is offline  
Old 21 March 2011, 19:40   #9
Graham Humphrey
Moderator
 
Graham Humphrey's Avatar
 
Join Date: Jul 2004
Location: Norwich, Norfolk, UK
Age: 37
Posts: 11,167
Quote:
Originally Posted by r0ber7 View Post
When not run in Blitz mode, 256 colour bitmap + shapes blitted on it works perfectly, but in Blitz mode it tells me "too many bitplanes to load". Perhaps blitz mode is not for AGA? I'm considering not making it an AGA game...
What version of Blitz are you using? 2.1 supports the AGA chipset. You need to use the Display library of commands though (like InitCopList, CreateDisplay, DisplayBitmap) as the Slice command and the other 'normal' display commands don't support AGA.

Nice graphics - good luck and if you need any help give me a shout - I used to code in Blitz quite a lot myself but haven't done much for a few years. I'm looking to get back into it very soon though
Graham Humphrey is offline  
Old 21 March 2011, 19:53   #10
r0ber7
it's all in your head
 
r0ber7's Avatar
 
Join Date: Feb 2011
Location: The Netherlands
Posts: 174
Quote:
Originally Posted by Djay View Post
nice... what kinda game is it... platform adventure?
I was thinking along those lines, yeah. How it will exactly turn out remains to be seen.

Quote:
Originally Posted by Graham Humphrey View Post
What version of Blitz are you using? 2.1 supports the AGA chipset. You need to use the Display library of commands though (like InitCopList, CreateDisplay, DisplayBitmap) as the Slice command and the other 'normal' display commands don't support AGA.
Found the lib, reading up on it now.
r0ber7 is offline  
Old 22 March 2011, 14:50   #11
r0ber7
it's all in your head
 
r0ber7's Avatar
 
Join Date: Feb 2011
Location: The Netherlands
Posts: 174
Ok, I've got the smoking wizard figured out in Blitz mode, 256 colours.

Next stop: Key input -> walking wizard around with arrow keys. Simple enough, I use RawStatus() to check for key input and change the wizard's position and animation according to which way we're walking/jumping. But!

I face an obstacle: RawStatus() requires the raw key code to check if a key is being pressed. I've been looking around for a key code reference, but can't find it. I can't figure out which key codes are used for the arrow keys, so if anyone knows of a keycode reference, let me know. The examples dir contains an example to check for the F1 key, but I don't wanna use the F-keys to walk around!
r0ber7 is offline  
Old 22 March 2011, 14:57   #12
killergorilla
Lesser Talent
 
killergorilla's Avatar
 
Join Date: Jan 2003
Location: UK
Age: 42
Posts: 7,957
Here's a list of the rawkey codes...

http://whdload.de/docs/en/rawkey.html

Hope it helps!
killergorilla is offline  
Old 22 March 2011, 15:01   #13
r0ber7
it's all in your head
 
r0ber7's Avatar
 
Join Date: Feb 2011
Location: The Netherlands
Posts: 174
Nice! Thanks for the quick reply, I'm off to get started on world 1.

Edit: I've got the little guy walking around, and jumping quite realistically.

Last edited by r0ber7; 22 March 2011 at 18:04.
r0ber7 is offline  
Old 22 March 2011, 23:02   #14
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Quote:
Originally Posted by Djay View Post
nice... what kinda game is it... platform adventure?
It looks to me like a wizardy version of little computer people. That would be groovy! lol.
Steve is offline  
Old 23 March 2011, 01:22   #15
r0ber7
it's all in your head
 
r0ber7's Avatar
 
Join Date: Feb 2011
Location: The Netherlands
Posts: 174
Here's the first basic setup for a world:

[ Show youtube player ]

r0ber7 is offline  
Old 23 March 2011, 11:37   #16
Djay
95th User
 
Djay's Avatar
 
Join Date: May 2001
Location: Brighton/UK
Age: 48
Posts: 3,120
Looking good.. If you looking for someone to help out with testing on both winuae and real A1200 drop me a pm I would be happy to help

Sometime ago I was thinking of creating a similar game which featured a wizard that had to beat bosses by collecting items froms baddies and through solving puzzles.. The bosses physically blocked your advancement to the next part of the level...
Djay is offline  
Old 23 March 2011, 18:50   #17
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Cool video and, as you previously stated, he is jumping realistically. Good to see you living the old coding spirit - working til all hours of the night (1:15am)


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 24 March 2011, 08:31   #18
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Checked out the vid - it looks really nice!

From no Blitz coding experience to this in a few days is excellent work and just goes to prove that the best way to learn to code is to think of something you'd like to code and just get on and code it!

Looking forward to seeing more progress on this and playing the finished game too.
pmc is offline  
Old 24 March 2011, 12:21   #19
r0ber7
it's all in your head
 
r0ber7's Avatar
 
Join Date: Feb 2011
Location: The Netherlands
Posts: 174
Thanks for the comments. Really fun doing pixely stuff on Amiga again.

Quote:
Originally Posted by Djay View Post
Looking good.. If you looking for someone to help out with testing on both winuae and real A1200 drop me a pm I would be happy to help
You'll hear from me when I have a somewhat working world.

Quote:
Originally Posted by Lonewolf10 View Post
Good to see you living the old coding spirit - working til all hours of the night (1:15am)
lol, I've had worse. Being unemployed helps as well, hehe.

Quote:
Originally Posted by pmc View Post
From no Blitz coding experience to this in a few days is excellent work and just goes to prove that the best way to learn to code is to think of something you'd like to code and just get on and code it!


To be fair, I'd already coded a setup for a similar game (same wizard sprites) in C/C++ on linux with OpenGL. OpenGL being a 3d engine, it provided me with nice "depth" in the background scrolling, but the pixeled wizard came out looking rather bad. Blitz2 is much easier to learn than OpenGL, and the concepts are the same. There's still a lot to learn however. I lost the C code due to a corrupt partition. Glad I saved the sprites though!

To the Blitz coders around here:

Right now, first I build a bitmap for the world like this:

Code:
LoadShape 0, "dh3:iff/world1/w1-1.iff",1
LoadShape 1, "dh3:iff/world1/w1-2.iff"
LoadShape 2, "dh3:iff/world1/w1-3.iff"

Use BitMap 1
Blit 0,0,0
Blit 1,320,0
Blit 2,640,0
Then, for every frame, I blit the wizard on that bitmap, and redraw the bitmap, like so:

Code:
; right arrow key
  If RawStatus(78)
    UnBuffer 0
    x=x+2
    BBlit 0,i,140+x,y
After that:

Code:
  DisplayBitMap 1,1,x,0
  VWait
My main concern now is that the movement from right-left / left-right seems a bit jittery at times. Instead of it being a fluid motion, sometimes when walking around (about every few seconds or so) the bitmap scrolls just a little bit faster than it usually does. What's up with that? There's only one Vwait in the code, so it should be a consistent scrolling speed, shouldn't it? Do you think that, if I used sprites for the wizard, instead of the blitting to bitmap, this wouldn't occur? Or is it because I constructed the bitmap from several shapes?


Edit: I think double buffering might solve this... Still, I wonder what's more efficient: bblitting every shape on the bitmap or using sprites?

Last edited by r0ber7; 24 March 2011 at 15:56.
r0ber7 is offline  
Old 24 March 2011, 18:36   #20
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Sprites are more efficient but have constraints (number colours, width etc).. It is worth experimenting with both i suppose and double buffering may be beneficial
BippyM is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blitz2: Hires laced BippyM Coders. Language 25 06 February 2020 01:07
Blitz2 keyboard issues htdreams Coders. Blitz Basic 2 16 August 2013 15:58
Blitz2 Newcommandset BippyM Coders. Language 0 21 July 2012 23:59
Blitz2 Manual AlfaRomeo Amiga scene 18 01 May 2009 10:53
Embed data in Blitz2 programs oRBIT Coders. General 25 06 April 2007 19:49

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:32.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09795 seconds with 13 queries