Author Topic: REALBasic / Related noob questions...  (Read 1649 times)

0 Members and 1 Guest are viewing this topic.

Offline Pickles42

  • ZX 81
  • *
  • Posts: 5
  • Karma: 2
    • View Profile
REALBasic / Related noob questions...
« on: February 03, 2013 »
Ok, so I'd look to do two things with the project I'm currently working on (I'd like to call it a demo but I don't know if it's quite amazing enough to go into that category) :

1. Generate a simple scrolling starfield. I have a rough idea of how to do this in terms of "pseudo-code" and C++ stuff, but I'm kinda stuck in regards to writing something for REALBasic (or even Basic orientated for that matter).

2. Be able to warp a picture, ideally into a sine wave shape.
2a. Modify my existing scroll text code so it's a sine scroller.

At the moment my scroll text is actually an image (that way I can have my custom font displayed on any machine) but I'd really like to be able to warp it so that it's a sine scroller.

If anyone can help, I would appreciate it. My project thus far is pretty boring and this would let me make it a bit more interesting.

Thanks in advance!

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: REALBasic / Related noob questions...
« Reply #1 on: February 05, 2013 »
I haven't used Real Basic, but I've used other forms of Basic, so this code shouldn't be too far from the mark.

The following can set the initial positions and speeds for 32 stars, but you'll need to type in the dimensions of the screen in place of the [screen width] and [screen height] text without the square brackets.
Code: [Select]
screenW = [screen width]
screenH = [screen height]
starCount = 32
dim starsS(starCount)
dim starsX(starCount)
dim starsY(starCount)
for star = 1 to starCount
  starsS(star) = ran(10) + 1
  starsX(star) = ran(screenW)
  starsY(star) = ran(ScreenH)
next star

You'll still need to write code to move and display the stars.
You are our 9001st visitor.
Challenge Trophies Won:

Offline padman

  • Senior Member
  • Pentium
  • ********
  • Posts: 977
  • Karma: 258
    • View Profile
Re: REALBasic / Related noob questions...
« Reply #2 on: February 05, 2013 »
I think this forum thread should get you started regarding the starfield:

>> Click <<
Challenge Trophies Won:

Offline Pickles42

  • ZX 81
  • *
  • Posts: 5
  • Karma: 2
    • View Profile
Re: REALBasic / Related noob questions...
« Reply #3 on: February 05, 2013 »
combatKing, I'll try messing around with that code, see if I can get something.

As for the code on that other thread, while it seemed hopeful, I got nothing but errors when I tried utilizing it, I don't know what version of RB they were using but it doesn't work with mine :/