• Print

Author Topic: hey guys, let's give garry some help, please!  (Read 4324 times)

codeguy

  • Hero Member
  • *****
  • Posts: 3552
  • what the h3ll did i name that code?
    • stuff at dkm
    • Email
hey guys, let's give garry some help, please!
« on: January 26, 2011, 07:09:30 PM »
garry, i think between all of us, we can make a nicely commented program that will be good in many ways. too many of us have been working on solo projects and i think making this program shine with our collective efforts would be worthwhile. we need someone to help us get this nice piece of work shined up (cyperium, olddoslover, darthwho, unseenmachine, zom-b and anybody else)? i know just enough to make me dangerous but not enough to make this into what ya want by myself.
Code: [Select]
REM
DEFLNG A-Z

CONST True = -1, False = NOT (True)

SCREEN 12
Background& = _LOADIMAGE("abackground.bmp") 'create the background page
WorkPage& = _LOADIMAGE("Hawk_sprite.bmp") 'create the sprite sheet page
_COPYPALETTE WorkPage&, 0
FrameNum& = 0: x1 = 100: y1 = 100: direction = 1: flap = 0: Active = 0: ShowBox = True: Captured = False



DO
' I added this, to show where I want to drop the bunny (circle)
    LOCATE 2, 4
    PRINT "drop the bunny here"
    PRINT "X"
' End of my edit,also when the bunny is released it no longer moves,later maybe
' another one comes out,each bunny caught is X number of points,thats the idea
' anyway
    _DISPLAY
    _LIMIT 20
    GOSUB Getkey
    _PUTIMAGE , Background&, 0
    GOSUB Showframe
    IF Captured = False THEN
        GOSUB Showbunny
        GOSUB Collision
    ELSE
        bx = x1 + 50: by = y1 + 54
        CIRCLE (bx, by), 5, 14
    END IF
    LOCATE 29, 1: PRINT bx, hx1, hy1, rx1, rx2
LOOP UNTIL INP(&H60) = 1
SLEEP
SYSTEM

Getkey:
IF _KEYDOWN(20480) THEN y1 = y1 + 4
IF _KEYDOWN(18432) THEN y1 = y1 - 4
IF _KEYDOWN(19200) THEN
    x1 = x1 - 4: direction = 2
END IF
IF _KEYDOWN(19712) THEN
    x1 = x1 + 4: direction = 1
END IF
RETURN

Showframe:
SELECT CASE FrameNum&
    _CLEARCOLOR 0, WorkPage&
    CASE 0
        IF direction = 1 THEN
            _PUTIMAGE (x1, y1)-(x1 + 89, y1 + 67), WorkPage&, 0, (1, 1)-(89, 67)
        ELSE
            _PUTIMAGE (x1, y1)-(x1 + 89, y1 + 67), WorkPage&, 0, (89, 1)-(1, 67)
        END IF
    CASE 1
        IF direction = 1 THEN
            _PUTIMAGE (x1, y1)-(x1 + 89, y1 + 67), WorkPage&, 0, (91, 0)-(187, 67)
        ELSE
            _PUTIMAGE (x1, y1)-(x1 + 89, y1 + 67), WorkPage&, 0, (187, 0)-(91, 67)
        END IF
END SELECT
flap = flap + 1
IF flap = 3 THEN
    flap = 0
    FrameNum& = FrameNum& + 1
END IF
IF FrameNum& = 2 THEN FrameNum& = 0
RETURN

Makchance:
chance = INT(RND * 10) + 1
RETURN

Movbunny:
dir = INT(RND * 2) + 1
IF dir = 1 THEN
    dir = 4: x = -10
ELSE
    dir = -4: x = 650
END IF
RETURN

Showbunny:
IF Active = 1 THEN
    bx = bx + dir
    CIRCLE (bx, 400), 5, 14
    IF bx <= 0 OR bx >= 640 THEN
        Active = 0
    END IF
ELSE
    GOSUB Makchance
    IF chance = 9 THEN
        Active = 1
        GOSUB Movbunny
    END IF
END IF
RETURN

Collision:
hx1 = x1 + 42: hx2 = x1 + 58 'horizontal co-ord of hawk feet
hy1 = y1 + 46: hy2 = hy1 + 10 'vertical  co-ord of hawk feet
rx1 = bx - 4: rx2 = rx1 + 12 'rabbit right + left side co-ords

IF ShowBox = True THEN
    LINE (hx1, hy1)-(hx2, hy2 + 10), 5, B
END IF

IF hy1 >= 394 AND hy2 <= 404 THEN
    IF hx1 >= rx1 AND hx1 <= rx2 THEN
        IF Captured = False THEN
            Captured = True
            SOUND 2500, 1
        END IF
    END IF
END IF
RETURN
« Last Edit: January 26, 2011, 07:43:18 PM by codeguy »
http://denteddisk.forums-free.com/make-an-appointment-with-the-resident-code-guru-f34.html

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #1 on: January 26, 2011, 07:15:11 PM »
Hi all,
    I'll help out.
OlDosLover.

unseenmachine

  • Hero Member
  • *****
  • Posts: 3285
  • A fish, a fish, a fishy o!
Re: hey guys, let's give garry some help, please!
« Reply #2 on: January 26, 2011, 07:36:49 PM »
I am off course allways willing to help but will need a bit of info.

Who's doing what? Who wants to do what?
What are we doing it with? (QB64 only, DQb2Qb64, UnseenGDK(My preferance off course!!), something new?)

Unseen
UnseenGDK Download : http://dl.dropbox.com/u/8822351/UnseenGDK.bm
GDK Tutorial : http://dl.dropbox.com/u/8822351/UnseenGDK_Tutorial.doc
VQB02 : http://dl.dropbox.com/u/8822351/VQB02.zip

codeguy

  • Hero Member
  • *****
  • Posts: 3552
  • what the h3ll did i name that code?
    • stuff at dkm
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #3 on: January 26, 2011, 07:51:56 PM »
i think he wants to make it so the rabbit (now a circle) runs and the bird tries to catch it. we need an animated bunny running and i think for the sake of ease, we need to store images in a record like this:
type GAMEImage
currentx as integer '* location on screen of image
currenty as integer
handle as long '* for moving, etc
picwidth as integer' * to get bounding box dimensions for unseenmachine's collision algo.
picheight as integer
clearcolor as long '* default this to 0 (black)
numxsegs as integer '* for animated sprite sheets
numysegs as integer
end type
at the very least.

this will help us get the bounding box for collisions (unseenmachine, ya got a nice bounding-box collision algo!). don't think this will need nspace as it's only 2 objects. the only collision checking will be between the rabbit and the hawk, so this part should be simple. the background graphic is nice but makes the hawk difficult to see, so maybe a little different color scheme for these would be nice. key-control should also be supplemented with mouse control too for the hawk. when thee hawk gets to a certain height, it should auto-drop the rabbit, maybe with a sound effect. and maybe a sound effect for the hawk too (ideally an mp3 or wav for both). the hawk animation is 2 pictures roughly same width, but i would prefer it be 2 pictures for the sake of ease, but i know your gdk is capable of handling multi-image sprite.
« Last Edit: January 26, 2011, 08:50:32 PM by codeguy »
http://denteddisk.forums-free.com/make-an-appointment-with-the-resident-code-guru-f34.html

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #4 on: January 26, 2011, 07:57:21 PM »
Hi all,
    Guys lets make this simple so he can follow it. The images i have for it seem to have an odd palette! I dont think Garry understands user types as yet. I suggest we get rid of screen 12 and make a_newimage (540,480,32). What you all think?

Link to the Graphics:http://dl.dropbox.com/u/10291175/GazRabPics.rar
OlDosLover.

DarthWho

  • Hero Member
  • *****
  • Posts: 3853
  • Timelord of the Sith
Re: hey guys, let's give garry some help, please!
« Reply #5 on: January 26, 2011, 08:03:09 PM »
I'll help just let me get done with my classes tomorrow and then I have 3 consecutive days that I can offer my skills (i will still be working on other things but still i will do my best to help out)
Rassilon: My lord Doctor; My lord Master; My lord DarthWho
The Doctor and the master at the same time :WHAT!?!?!

FastMath 1.1.0 released: http://dl.dropbox.com/u/12359848/fastmath.h

unseenmachine

  • Hero Member
  • *****
  • Posts: 3285
  • A fish, a fish, a fishy o!
Re: hey guys, let's give garry some help, please!
« Reply #6 on: January 26, 2011, 08:03:24 PM »
Fair enough.

Why does the rabbit run? What causes it to run? The hawks shadow?
Where does it run to?
What else is there for the hawk to avoid? Squirrels throwing nuts from trees? Trees?

The type you suggest is pretty much a texture type!For sprite sheets you need to remember to divide by the x and y frame counts to get the size for the collision box. This is all amalgamated into a GameObject Type in UnseenGDk03. (Texture,vector and rectangle).

Code: [Select]

TYPE Texture
  File AS LONG
  Width AS INTEGER
  Height AS INTEGER
  Alpha AS LONG
  IsVisible AS INTEGER
  XFrameCount AS INTEGER
  YFrameCount AS INTEGER
  TotalFrameCount AS INTEGER
  RotationX AS INTEGER
  RotationY AS INTEGER
  RotationXSize AS INTEGER
  RotationYSize AS INTEGER
  Scale AS SINGLE
END TYPE

this is what i use for collisions (Both pixel perfect and non pixel perfect)

Code: [Select]
TYPE Rectangle
  X AS INTEGER
  Y AS INTEGER
  Width AS INTEGER
  Height AS INTEGER
  CollisionX AS INTEGER
  CollisionY AS INTEGER
  CollisionXX AS INTEGER
  CollisionYY AS INTEGER
END TYPE

SUB GDK_NewRectangle (RectRef AS Rectangle, x%, y%, Width%, Height%)
RectRef.X = x%
RectRef.Y = y%
RectRef.Width = Width%
RectRef.Height = Height%
END SUB


'http:// Returns -1 for true, 0 for false
FUNCTION GDK_DoesRectangleIntersect% (RectangleRef1 AS Rectangle, RectangleRef2 AS Rectangle)
IF RectangleRef1.X <= RectangleRef2.X + RectangleRef2.Width THEN
  IF RectangleRef1.X + RectangleRef1.Width >= RectangleRef2.X THEN
    IF RectangleRef1.Y <= RectangleRef2.Y + RectangleRef2.Height THEN
      IF RectangleRef1.Y + RectangleRef1.Height >= RectangleRef2.Y THEN
        GDK_DoesRectangleIntersect% = -1
      END IF
    END IF
  END IF
ELSE
  GDK_DoesRectangleIntersect% = 0
END IF
END FUNCTION


UnseenGDK Download : http://dl.dropbox.com/u/8822351/UnseenGDK.bm
GDK Tutorial : http://dl.dropbox.com/u/8822351/UnseenGDK_Tutorial.doc
VQB02 : http://dl.dropbox.com/u/8822351/VQB02.zip

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #7 on: January 26, 2011, 08:11:17 PM »
Hi all,
    Reread your proposed idea post codeguy and i agree. A green background would show up better i think
OlDosLover.

codeguy

  • Hero Member
  • *****
  • Posts: 3552
  • what the h3ll did i name that code?
    • stuff at dkm
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #8 on: January 26, 2011, 08:35:44 PM »
Fair enough.

Why does the rabbit run? What causes it to run? The hawks shadow? the rabbit is running because the hawk is nearby
Where does it run to? it just runs a linear path as it does now
What else is there for the hawk to avoid? Squirrels throwing nuts from trees? Trees? nothing for it to avoid

The type you suggest is pretty much a texture type!For sprite sheets you need to remember to divide by the x and y frame counts to get the size for the collision box. This is all amalgamated into a GameObject Type in UnseenGDk03. (Texture,vector and rectangle).
ok, then make it so for the gdk version, but include the source for the gdk in the program itself to eliminate what i call the black box effect
http://denteddisk.forums-free.com/make-an-appointment-with-the-resident-code-guru-f34.html

codeguy

  • Hero Member
  • *****
  • Posts: 3552
  • what the h3ll did i name that code?
    • stuff at dkm
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #9 on: January 26, 2011, 08:41:13 PM »
Quote from: unseenmachine on January 26, 2011, 07:36:49 PM
I am off course allways willing to help but will need a bit of info.

Who's doing what? Who wants to do what?
What are we doing it with? (QB64 only, DQb2Qb64, UnseenGDK(My preferance off course!!), something new?)

Unseen
i prefer a qb64-only version as that will help garry and others learn how to use qb64 on a more basic level. as cool as your gdk is, it will cause the black box effect, which is what we are trying to avoid.
http://denteddisk.forums-free.com/make-an-appointment-with-the-resident-code-guru-f34.html

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #10 on: January 26, 2011, 08:44:03 PM »
Hi all,
    I agree codeguy. Do a qb64 version and unseen can convert it to the GDK so Garry has 2 versions to learn from. This would aid the community also i think.

ps just make the rabbit appear randomly i reckon.
OlDosLover.

codeguy

  • Hero Member
  • *****
  • Posts: 3552
  • what the h3ll did i name that code?
    • stuff at dkm
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #11 on: January 26, 2011, 08:55:11 PM »
Quote from: OlDosLover on January 26, 2011, 07:57:21 PM
Hi all,
    Guys lets make this simple so he can follow it. The images i have for it seem to have an odd palette! I dont think Garry understands user types as yet. I suggest we get rid of screen 12 and make a_newimage (540,480,32). What you all think?

Link to the Graphics:http://dl.dropbox.com/u/10291175/GazRabPics.rar
OlDosLover.

this is a good time to explain user types in detail or at least well enough beginners can understand them.
http://denteddisk.forums-free.com/make-an-appointment-with-the-resident-code-guru-f34.html

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #12 on: January 26, 2011, 08:58:39 PM »
Hi all,
    I agree codeguy , just comment it well so that they will and the goal will be achieved i reckon.
OlDosLover.

GarryRicketson

  • Guest
Re: hey guys, let's give garry some help, please!
« Reply #13 on: January 26, 2011, 09:06:15 PM »
Quote from: OlDosLover on January 26, 2011, 07:57:21 PM
Hi all,
    Guys lets make this simple so he can follow it. The images i have for it seem to have an odd palette! I dont think Garry understands user types as yet. I suggest we get rid of screen 12 and make a_newimage (540,480,32). What you all think?

Link to the Graphics:http://dl.dropbox.com/u/10291175/GazRabPics.rar
OlDosLover.


OldDoslover, has a point, on my side of it, my interest is more in drawing and makeing the graphics, (images),...but not understanding completely what palettes, work best, etc.... I don't know if this can be used or not, ...
it is pretty simple, like the circle,...I need to fix something to eat, alot of posts came in quickly, .....and like I said before, I am pretty tired,
----- code below--------
DECLARE SUB PUT2 (Sprite() AS INTEGER, XSize AS INTEGER, YSize AS INTEGER, X AS INTEGER, Y AS INTEGER)
DEFINT A-Z
SCREEN 13
_FULLSCREEN
CLS

' Bitmap for the sprite
DATA 0,15,0,0,0,0,15,0,0,0
DATA 0,15,0,0,0,15,0,0,0,0
DATA 0,0,15,15,15,0,0,0,0,0
DATA 0,15,0,15,0,15,0,0,0,0
DATA 0,0,15,15,15,0,0,0,0,0
DATA 0,0,15,15,15,0,0,0,0,0
DATA 0,0,15,15,15,0,0,0,0,0
DATA 15,15,0,0,0,15,15,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
' An array to hold the sprite
DIM Ball%(9, 9)

' Read the sprite in from DATA to the array
FOR Y = 0 TO 9
    FOR X = 0 TO 9
        READ Ball%(X, Y)
    NEXT X
NEXT Y

' Draw the sprite from the array onto the screen
PUT2 Ball%(), 9, 9, 0, 0

SUB PUT2 (Sprite() AS INTEGER, XSize AS INTEGER, YSize AS INTEGER, X AS INTEGER, Y AS INTEGER)
' Draw the sprite from the array onto the screen
FOR YP = 0 TO YSize - 1
    FOR XP = 0 TO XSize - 1
        PSET (X + XP, Y + YP), Sprite%(XP, YP)
    NEXT XP
NEXT YP
END SUB
------- end code------
The images Oldoslover posted are the same, for the background, and hawk,...

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: hey guys, let's give garry some help, please!
« Reply #14 on: January 26, 2011, 09:14:04 PM »
Hi all,
    Garry its 3.15 pm in the afternoon here and its 34 degrees. What time is it there?
OlDosLover.

  • Print