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

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.
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


text$="Enlarged Font demo!"

text$="By displaying the text on a virtual screen"

text$="( CREATESCREEN ) you then ZOOM that Sprite"

text$="after a USESCREEN -1 call."

text$="Press <ESCAPE> to exit."

text$="Brick Redux, 2013"




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

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


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!


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

INC y1,y1dir
IF y1<40 OR y1>80

INC timer

IF timer=4


INC factorx,fdirx;INC factory,fdiry

IF factorx<0 OR factorx>5



IF factory<0 OR factory>5




And with alittle tweaking, you could use my former selfs :) colour alteration routine: too. :)
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 :).
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"

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

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.

Bless you my.....ARSE , GIRRLS, FECK, DRINK!....DRINK!....DRI....
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.
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!
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







FUNCTION move_the_player:

IF KEY(203) // Cursor LEFT.

INC angle

ELSEIF KEY(205) // Cursor RIGHT.

DEC angle


IF KEY(200) // Cursor UP

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


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.

ROTOSPRITE 1,player_x,player_y,angle



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.


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



FUNCTION move_the_grunts:


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


IF grunts[a].y<player_y

INC grunts[a].y,.1

ELSEIF grunts[a].y>player_y

DEC grunts[a].y,.1




// 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




SUB setup:

GETSCREENSIZE screenx,screeny

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

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


// 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_distance=150 // THE LIMIT A SHOT CAN TRAVEL.
shot_speed=2 //


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


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


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

(Sorry Ocean, couldnt resist.)
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.

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
Has he been on the channel 4 prog, four in a bed - by any chance :)
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.

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 )