Shots And Text Help


spaceboygp32x

Active Member
Joined
Jan 31, 2005
Messages
505
hi...

shooter nearly done...

im just converting the mouse controls i used (for my pc) to gp 32 controls...

ive use x=mouse.x o track the shot process and the ship

how do i make the shot track to the ship - after i have used

Code:
If (key (_right))
  x=x+5;
	End

	If (key (_left));
  x=x-5;
	End

to move my ship!


i.e the shot is still tracked to the mouse and i need it tracked to the keys..

+

is there a simple command which alters txt colour

ive used

Code:
WRITE_INT(0,0,0,0,OFFSET PLYSCORE);
WRITE_INT(0,300,0,0,OFFSET PLYLIVES);

to track score after setting them as globals

but my background is white same as the txt so they dont show up!!

hope you guys can help

sPaCe :ph34r:
 
Segata Sanshiro posted on Mar 25 2005 at 08:57 PM said:
It's as easy as using this function :D

SET_TEXT_COLOR ( INT color );

Hope it works fine

ok so set it globally not in the individuall process!

yay

anyone any ideas on the shot problem...

sPaCe
 
Last edited by a moderator:
Ah I forgot. It sounds easy, but it might not work too well...

Just put this inside the shot's main loop:

x=father.x; //Only works if the shot process is called from the ship code

Or you can make the ship's x coord. global:

shipx=x; //Inside the ship's main loop
...
x=shipx; //Inside the shot's main loop. I think its clear enough.
 
Segata Sanshiro posted on Mar 25 2005 at 09:28 PM said:
Ah I forgot. It sounds easy, but it might not work too well...

Just put this inside the shot's main loop:

x=father.x; //Only works if the shot process is called from the ship code

Or you can make the ship's x coord. global:

shipx=x; //Inside the ship's main loop
...
x=shipx; //Inside the shot's main loop. I think its clear enough.

thankyou!!!!

x=father.x:

works really well - my shot(); is called frop the ship ();

can you explain why it works (I dont want to borrow code i dont understand)
 
Last edited by a moderator:
Let's see... The shot is called from the ship, so the ship is shot's father ^_^;

When you call a process like this:

Code:
idprocess=myprocess();

you're actually storing that process' unique id number in the variable idprocess. Now you can access it's parametres likes this: idprocess.x, idprocess.graph, idprocess.flags... (you won't be able to get its private variables though).

So you could have called the ship process like this: idship=ship(...); and then you'd be able to access its x variable like this: idship.x But this time it wasnt necessary, cause for each process you have a set of private variables that are: father, son, bigbro, smallbro... as far as I can remember. They automatically store the id number of the appropriate process.

Wow that was a long post. Hope it's understandable lol
 
Mind that when the ship instance dies the reference dies and Fenix dies. You might want to check if the father still exists with the exists(INT id) function. :)
 
Segata Sanshiro posted on Mar 25 2005 at 10:14 PM said:
Let's see... The shot is called from the ship, so the ship is shot's father ^_^;

When you call a process like this:

Code:
idprocess=myprocess();

you're actually storing that process' unique id number in the variable idprocess. Now you can access it's parametres likes this: idprocess.x, idprocess.graph, idprocess.flags... (you won't be able to get its private variables though).

So you could have called the ship process like this: idship=ship(...); and then you'd be able to access its x variable like this: idship.x But this time it wasnt necessary, cause for each process you have a set of private variables that are: father, son, bigbro, smallbro... as far as I can remember. They automatically store the id number of the appropriate process.

Wow that was a long post. Hope it's understandable lol

So anything if i call a process from within ship();

the ship is the father and the process called is the son...

think i get it...

moogle - ive killed all the processes at game over like so:

Code:
 WRITE(0,125,100,0,"GAME OVER");
SIGNAL(TYPE SHOT,S_KILL);
SIGNAL(TYPE ROCK,S_KILL);
SIGNAL(TYPE SHIP,S_KILL);
WHILE (NOT KEY(_SPACE))// just while im coding to the pc
FRAME;

will this cause me problems using the 'father' command?
thanks for your help guys i guess it takes a while!

sPaCe :D
 
Last edited by a moderator:
It shouldn't be erroring you, but with fenix you never know. Best way to make sure is of course to put an exists(father) right before you use it's variables, especially when the linecount grows it's easy that you don't have to think about those things. But I'm preaching :p it's fine as it is too.
 
spaceboygp32x posted on Mar 25 2005 at 09:25 PM said:
Code:
If (key (_right))
  x=x+5;
	End

	If (key (_left));
  x=x-5;
	End


It should be easier/faster for you and you have less code, if you do it this way:

Code:
If(key(_right))x+=5;End

If(key(_left))x-=5;End

Yeah, I know, it`s just a style of coding, but you have to type less :D
 
Last edited by a moderator:
Back
Top