Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Brick Redux

#1
A big handy tip for all new users.

Part of your code not doing what you want it to do in run time? Place the END command inside your IF/ENDIFs that seem to be ignored in your running project. ( Or SUBs & FUNCTIONs )

Run your code & if it exits at the given point where your mysterious IF/ENDIF was checked you`ll know its being read but misinterpreted.  Go back and look at what youve coded to happen, then step backwards and look at whats leading to it being ignored.

Its also handy to have a pen and pad handy.  Pen and paper can save lots of time by scribbling down your plan and formulating that into code later on screen.  When it doesnt work - look at what you penned down. 

If the search option here fails to help you just ask as there are many here who can help you.
#2
Just come across this thread and realised I had a method of enlarging the current font that is quick and very simple.

Code (glbasic) Select
/// Quick and simple enlarged font method.
/// Coded by Mark Cooper AKA BRICK REDUX
/// Could be handy for text adventures etc?


/// Define the bits needed for the moving title and scaling quit request.
y1=50 ; y1dir=1 ; factorx=1 ; factory=1 ; fdirx=1 ; fdiry=1

WHILE TRUE

text$="Enlarged Font demo!"
largefont(text$,120,y1,3,4,0,RGB(255,0,0))

text$="By displaying the text on a virtual screen"
largefont(text$,70,120,1.5,3,0,RGB(0,0,150))

text$="( CREATESCREEN ) you then ZOOM that Sprite"
largefont(text$,70,140,1.5,3,0,RGB(0,150,0))

text$="after a USESCREEN -1 call."
largefont(text$,100,170,1.5,3,0,RGB(150,0,0))

text$="Press <ESCAPE> to exit."
largefont(text$,110,300,factorx,factory,1,RGB(RND(255),RND(255),RND(255)))

text$="Brick Redux, 2013"
largefont(text$,120,400,2,3,1,0)

GOSUB FX


SHOWSCREEN

WEND



// A$=text / xpos/ ypos / zoomfactor X / zoomfactor Y / Smoothshading on/off / background RGB

FUNCTION largefont:a$,x,y,scalex,scaley,shading,background

SMOOTHSHADING shading

LOCAL size=LEN(a$)

CREATESCREEN 4,2,size*8,9 // Sprite 2

USESCREEN 4 // Use an hidden screen

DRAWRECT 0,0,size*8,9,background // Fill the background with a colour.

PRINT a$,0,0 // Now print the text

USESCREEN -1 // Back to reality!

ZOOMSPRITE 2,x*2,y,scalex,scaley // Scale the text!

ENDFUNCTION

SUB FX: /// Only needed here for the moving and scaling text.

INC y1,y1dir
IF y1<40 OR y1>80
y1dir=-y1dir
ENDIF


INC timer

IF timer=4

timer=0

INC factorx,fdirx;INC factory,fdiry

IF factorx<0 OR factorx>5

fdirx=-fdirx

ENDIF

IF factory<0 OR factory>5

fdiry=-fdiry

ENDIF

ENDIF
ENDSUB


And with alittle tweaking, you could use my former selfs :) colour alteration routine: http://www.glbasic.com/forum/index.php?topic=8207.msg69270#msg69270 too. :)
#3
In the paintbox Ive selected what I call DOT.  You can also see all the nibs / stamps / brushes or what ever you want to call them :)  I added all of them with speed in mind when designing an image - saves messing around having to creating such a thing and then copy it as a brush.

I like GraFX but find the icons along the bottom annoying at times - my younger self still screams at this when reflecting upon DPaint :).
#4
Quote from: erico on 2013-Aug-30
About your sprite editor, it would wonderful if it also works on the likes of android or even a caanoo.
Since I got a note II I have been looking for productive tools on this front and alas there are none good enough... :(

Grafx2 may work ok but it is really hard to make it work and it dosen´t read the wacom pen on note II on a fine way, so it is actually useless.
I found a few sound/music programs that are more or less ok.
But I can state that android lacks productive tools to the point that if I had time I would code my own tools.

People may not work on phones, but the note II or bigger tablets are well capable to handle fine art and music for retro games.
Heck, when I´m travelling, time would be well spent drawing game assets on them. :(
I can do some of that stuff on my caanoo that the note II can´t handle at all.

I dream of a pixel sprite editor capable of handling animations and onion skin, it would be a dream come true if such appears on mobiles and tablets.

The best tool so far I found for it is Dr. Pepper´s "Cherry Brush"
http://www.drpetter.se/projects.html

Post a peep on your sprite editor when you can, I would like to see it.
Cheers.

Ok Erico, here you go - a sneek peek at my editor.  The leen eyed will notice no save/load/animate etc icons. Thats because i click the tab under the paintbox from 1 to 2 to display the other icons/options.

#5
Bless you my.....ARSE , GIRRLS, FECK, DRINK!....DRINK!....DRI....
#6
In my Sprite Editor I found this way to use a sprite/brush as a pattern fill.

First fill the selected area with the set transparent colour.
Copy the selected area to a virtual screen.
Grab it as a Sprite.
Save the Sprite. (only way to later recognise the transparency)
Draw the Pattern in columns & rows inside the virtual screen.
Load the Sprite and draw it over the Pattern.
Copy back to the main screen.

I dunno how this would work with full screen, but it works like a dream in my editor.

Hope it helps anyone exploring this.
#8
Quote from: erico on 2013-Aug-23
Thanks, here is the latest one with a better size (200x250 upscaled to 800x500).

Original sprites in png, square pixel.
plus a mock

Super nice blocky GFX Erico, just what I needed.  Will add them to the Hawks prog and post a demo soon. Watch this space. Brilliant!
#9
Heres something I knocked up in 2 hours that was inspired from an old CPC type-in game.  The CPC version had you avoiding smily faces that homed in on you in 8x8 pixel steps. 

My code gives you pixel by pixel approaching hordes that rotate to always face you.  The code could be adapted to display a tank or car very easily.

For fun Ive given the player a gun so that you can shoot them all down.  The sprites included have no transparency folks. 

Hope someone finds it useful.


LEFT/RIGHT cursors to rotate the player. UP cursor to move forward & SPACE to fire.

Code (glbasic) Select

////////////////////////
//            //
//       GRUNTS    //
//                        //
///////////////////////

// Avoid the Zombies,their dying to meet you...yawn.

GOSUB setup

WHILE TRUE

move_the_grunts()

move_the_player()

shoot()

SHOWSCREEN

WEND


FUNCTION move_the_player:

IF KEY(203) // Cursor LEFT.

INC angle

ELSEIF KEY(205) // Cursor RIGHT.

DEC angle

ENDIF

IF KEY(200) // Cursor UP

DEC player_x,SIN(angle)
DEC player_y,COS(angle)

ENDIF

IF KEY(57) AND player_shot=0 // Space bar = FIRE

player_shot=1 // New shot initialised.
oldangle=angle // Get vector angle for the new bullet.

sx=player_x+SIN(oldangle) // Assign the above into
sy=player_y+COS(oldangle) // the bullets x & y projectory.

ENDIF
ROTOSPRITE 1,player_x,player_y,angle

ENDFUNCTION



FUNCTION shoot:

IF player_shot=1 // Gun has just fired.

DEC sx,shot_speed*SIN(oldangle) // Move x & y along "oldangle" vector.

DEC sy,shot_speed*COS(oldangle)

INC shot_timer // Check how long the bullets been moving.

IF shot_timer=shot_distance

player_shot=0 // Remove the bullet.

shot_timer=0 // Reset the timer.

ENDIF

PRINT "@",sx,sy // Draw the Shot on screen.

ENDIF

ENDFUNCTION



FUNCTION move_the_grunts:

SMOOTHSHADING 0

FOR a=0 TO 18

IF grunts[a].hit=0 // If not been shot yet.

  LookX = player_x - grunts[a].x // Calc the angle
        LookY = player_y - grunts[a].y // so that each grunt
        LookAtPlayer = -ATAN(LookY, LookX)-90 // faces the player.
       
ROTOSPRITE 0,grunts[a].x,grunts[a].y,LookAtPlayer
     
     INC grunts[a].timer
     
      IF grunts[a].timer=grunts[a].limit // Grunt must move...urgggh!
         
IF grunts[a].x<player_x

INC grunts[a].x,.1

ELSEIF grunts[a].x>player_x

DEC grunts[a].x,.1

ENDIF

IF grunts[a].y<player_y

INC grunts[a].y,.1

ELSEIF grunts[a].y>player_y

DEC grunts[a].y,.1

ENDIF

grunts[a].timer=0

ENDIF

// Check if a grunt has been hit.

IF BOXCOLL(sx,sy,10,10,grunts[a].x,grunts[a].y,10,10)=1
grunts[a].hit=1 // Turn the grunt off.
player_shot=0 // Reset
ENDIF

ENDIF

NEXT


ENDFUNCTION


SUB setup:

GETSCREENSIZE screenx,screeny

TYPE oinks
x
y
timer // Determines when the grunt can move...
limit // ...by reaching a time limit.
hit // Is the grunt dead (erm its already un-dead) or alive.
talk // display a line of text.
ENDTYPE

GLOBAL grunts[] AS oinks ; DIM grunts[20]

FOR a=0 TO 18

grunts[a].x=RND(screenx) ; grunts[a].y=RND(screeny)
grunts[a].timer=0 ; grunts[a].limit=5+RND(5) ; grunts[a].hit=0

NEXT

// Player data.  Not kept inside a TYPE, this is so that readers can better understand how each component works.(if needed.)

player_x=100 // XPOS.
player_y=100 // YPOS
player_speed=1 // INCREASE TO MOVE QUICKER
player_shot=0 // SHOT NOT-FIRED/FIRED FLAG
shot_timer=0 // COUNTS UNTIL IT REACHS "SHOT_DISTANCE"
shot_distance=150 // THE LIMIT A SHOT CAN TRAVEL.
shot_speed=2 //
angle=0 // USED BY THE PLAYER AND BULLET.

// CREATE A SIMPLE PLAYER SPRITE (SEEN FROM ABOVE)

DRAWRECT 0,2,24,10,RGB(0,100,255);DRAWRECT 8,0,8,8,RGB(255,255,100)
GRABSPRITE 1,0,0,24,24

// And a grunt sprite.

DRAWRECT 0,2,24,10,RGB(0,50,255);DRAWRECT 8,0,8,8,RGB(0,255,0)
GRABSPRITE 0,0,0,24,24

ENDSUB



#10
I see what youve done and hope you will rewrtie it.  Nice one. :good:
#11
Quote from: Marmor on 2013-Aug-05
Remember Titanic !

;D

Yep, the movie that trusts the ocean to give it safe passage.

(Sorry Ocean, couldnt resist.)
#12
This bug relates to the forum.

Is it time the Beta Test thread was cleaned up / streamlined, as alot of the posts their offer links to dead webpages.  Not helpful and very dissapointing when wishing to try out someones work.  I cant be the only person here whose noticed this.

#13
Quote from: Ian Price on 2013-Aug-07
QuoteHas he been on the channel 4 prog, four in a bed - by any chance 
I have no idea  O_O

http://en.wikipedia.org/wiki/Four_in_a_Bed
#14
Has he been on the channel 4 prog, four in a bed - by any chance :)
#15
Theres also a game maker call Sprites Alive. It gives you an extra 70 commands to basic that include missile , bullet, collide, move, hit, explode, animate, maze etc. You might find the screen commands interesting as they allow you to alter the size of the screen.  It comes with its own sprite editor too.

http://cpcwiki.eu/index.php/Sprites_Alive

I once used it and made a 6 screen - helicopter inside a cavern type game.  Your goal was to move to the far right of the screen whilst navigating the caverns terrain and monsters.  It looked a bit like Magic Carpet ( C 64 )