Author Topic: circling text  (Read 7545 times)

0 Members and 1 Guest are viewing this topic.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
circling text
« on: February 07, 2007 »
Code: [Select]
open window 640, 512
window origin "cc"
cs = cos(pi/900)
sn = sin(pi/900)
for d = 0 to 1
   setdispbuf draw
   draw = 1 - draw
   setdrawbuf draw
   setrgb 1, 255, 000, 000
   setrgb 2, 255, 000, 000
   setrgb 3, 000, 000, 000
   gtriangle -320,000 to  320,000 to 320,-256
   gtriangle -320,000 to  320,000 to 320, 256
   setrgb 2, 000, 000, 000
   gtriangle -320,000 to -320,-256 to 320,-256
   gtriangle -320,000 to -320, 256 to 320, 256
   setrgb 1, 000, 000, 255
   setrgb 2, 000, 000, 000
   setrgb 3, 000, 000, 000
   gtriangle 000,-256 to -320,000 to 320,000
   gtriangle 000, 256 to -320,000 to 320,000
next

00 c = c + 1
   if (c > 27) exit
   read message$
   redim message$(len(message$))
   length = token(message$, message$())
   redim x(length), y(length)
   for l = 1 to length
      ang = l * (pi/length)
      x(l) = cos(ang)*200
      y(l) = sin(ang)*200
   next
   count = 0

10 setdispbuf draw
   draw = 1 - draw
   setdrawbuf draw
   for l = 1 to length
      x = cs*x(l) + sn*y(l)
      y = cs*y(l) - sn*x(l)
      if (y > 0) then
         setrgb 1, y, y, 0
      else
         setrgb 1, -y, -y, 0
      fi
      fill box x-10,y-10 to x+10,y+10
      setrgb 1, y, y, 0
      text x,y-5, message$(l), "cc"
      x(l) = x
      y(l) = y
   next
   count = count + 1
   if (count > 1800) goto 00
   goto 10

data "R A I N S T O R M"
data "P R E S E N T S"
data "H I S . F I R S T"
data "I N T R O"
data "B I G . S H O U T S"
data "G O . O U T . T O"
data "A L L . T H E"
data "G U Y S & G I R L S"
data "F R O M . T H E"
data "F O R U M"
data "S P E C I A L"
data "M E N T I O N"
data "F O R . T H E"
data "G U Y S"
data "F R O M . T H E"
data "Y A B A S I C"
data "B O A R D"
data "B I K E M A D N E S S"
data ". . . C L A N K Y . . ."
data "R A I N S T O R M"
data "S A Y S . H I"
data "H O P E . Y O U"
data "L I K E D . T H I S"
data "I N T R O"
data "B E C A U S E"
data "I T S . O V E R"
data "G O O D - B Y E"



Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: circling text
« Reply #1 on: February 07, 2007 »
Cool stuff Rain Storm!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: circling text
« Reply #2 on: February 07, 2007 »
Anyone got a working super mario clone? One that doesnt allow you to jump muliple times before landing and that allows you to fall off the bottom of the screen?

Challenge Trophies Won:

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 319
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Re: circling text
« Reply #3 on: February 08, 2007 »
Nice exercise sample to learn from.

Have a Yahappy day.

Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: circling text
« Reply #4 on: February 08, 2007 »
I made a mario clone before... not good... and I don't have the code any more. But I think I can wip up a sample code for jumping *multiple times* if you like... can't do it now because my brother wants ago on the computer.

Also, thanx for the shout!!!

*edit*

---------

Ok, I didn't know you wanted multiple jumps... I will see what I can come up with
« Last Edit: February 08, 2007 by CLANKY »
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: circling text
« Reply #5 on: February 08, 2007 »
Thanks guys. I tried a mario clone before as well but always the jumps didnt work you could jump to infinity or worse you could not jump if a block existed two squares above your head Im not very good at platforms but I think its time I tried one.

Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: circling text
« Reply #6 on: February 09, 2007 »
I have a simple jump code which lets you jump only once? Maybe you could inhance it to multiple. I have been trying but haven't got it with multiple.

Code: [Select]
open window 640,512

x=20:y=450

label loop
  setdrawbuf db
  db=1-db
  setdispbuf db
  clear window
'CONTROLS
j=peek("port1")
  if and(j,32)<>0 x=x+5
  if and(j,128)<>0 x=x-5
  if and(j,16384)<>0 jump=1
'CHK
  if x<8 x=8:if x>632 x=632
'JUMP FUNCTIONS
  if jump=0 then
    grav=0
  elsif jump=1 then
    grav=grav+0.18
    if grav>12 grav=12
    y=(y-6)+grav
    if y>450 then:jump=0:y=450:fi
  fi
'DRAW PLAYER / RECTANGLE
setrgb 1,100+(jump*50),0,0
fill rect x-8,y-8,x+8,y+8
'DISPLAY STATUS
setrgb 1,100,0,0
text 10,10,"X: "+str$(x)+", Y:"+str$(y)
text 10,21,"Jump Stat: "+str$(jump)
text 10,32,"Grav: "+str$(grav)
text 10,43,"Times: "+str$(times)
wait 0.008
goto loop
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: circling text
« Reply #7 on: February 09, 2007 »
Thats exactly what I was talkin about I wanted it so that you could jump but could not jump again until after you landed thanks a million Clanky I have work now but I will check out the code when I finish Thanks again buddy :buddies:

Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: circling text
« Reply #8 on: February 10, 2007 »
Nice work hey?  :clap:
Do you understand how it works? (I guess you would!  :inspired:)
Cheers, and no worries on helping you out hey.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: circling text
« Reply #9 on: February 10, 2007 »
You use the variable jump as a flag and a jump can only be initiated if that flag is not true the flag gets reset when the box lands on a centain platform. I have tried this technique but it never worked like the one you posted I always got strange results. Any ways this will be useful in my next project this would've made it or broke it

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: circling text
« Reply #10 on: February 10, 2007 »
It's kind of like a state-machine.  In the Skateboarding game I wrote I had things like
SKATER_ON_GROUND
SKATER_IN_AIR
SKATER_ON_RAIL
SKATER_DEATH_THROES
SKATER_DEAD
You hold that in a variable called skater_state.  Then when an event happens you can check the state and see if something needs doing, eg.
Code: [Select]
if (skater_state = SKATER_ON_GROUND)
  if (jumped) jump(); skater_state = SKATER_IN_AIR;
else if (skater_state = SKATER_IN_AIR)
  if (jumped) do_nothing()
else if (skater_state = SKATER_ON_RAIL)
  if (jumped) detach_from_rail(); jump();  skater_state = SKATER_IN_AIR;
else if (...)
  ...
fi

...
move_skater()
...

if (skater_state = SKATER_IN_AIR)
  if (hitground()) skater_state = SKATER_ON_GROUND;
fi

That kind of thing.  That's how all games programmers would approach it.  It's just slightly more complicated and flexible than using 'jump' but in essence it's exactly the same thing.

Jim
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: circling text
« Reply #11 on: February 10, 2007 »
I get you you assign a numeric value to each state and hold those values in variables that clearly describe what that state is this could be used in a jump routine with states such as jump=1, skid=2, fall=3 and I could use animation based on those states. thats somethin I wanted to include but wasnt sure of how to do it but that makes this feature alot more simple

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: circling text
« Reply #12 on: February 10, 2007 »
That's right, somewhere else I have

const SKATER_ON_GROUND=0
const SKATER_IN_AIR=1
const SKATER_ON_RAIL=2
const SKATER_DEATH_THROES=3
const SKATER_DEAD=4

It's really good to give these constants names because then the code is more readable, and it lets you add new names, new constants, or change a name and force the code to error so you can find all the places that reference that state.  In C or FB you wouldn't lose any speed by do it either - the compiler just replaces the name with the constant before compilation.

You might want to keep the animation state separate from the player state as a variable.  Obviously they are linked but sometimes you might want to change animation without changing state.
eg. You might have the player in the air in a falling animation, and then when he hits the ground you want to go from state 'in air' to state 'on ground'.  That would mean it would start playing the 'on ground' animation, but you might want to play a landing animation or a splat animation first.

Jim
« Last Edit: February 10, 2007 by Jim »
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: circling text
« Reply #13 on: February 11, 2007 »
Thanks for the insight Jim its great having so many people around to learn from their experience

Challenge Trophies Won: