1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dismiss Notice

Shots And Text Help

Discussion in 'Div / Fenix / BennuGD Zone' started by spaceboygp32x, Mar 25, 2005.

  1. spaceboygp32x

    spaceboygp32x 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:
     
    Tags:
  2. Segata Sanshiro

    Segata Sanshiro Member

    Joined:
    Feb 19, 2005
    Messages:
    162
    Location:
    Madrid
    It's as easy as using this function :D

    SET_TEXT_COLOR ( INT color );

    Hope it works fine
     
  3. spaceboygp32x

    spaceboygp32x Member

    Joined:
    Jan 31, 2005
    Messages:
    505
    ok so set it globally not in the individuall process!

    yay

    anyone any ideas on the shot problem...

    sPaCe
     
    Last edited by a moderator: Feb 3, 2016
  4. Segata Sanshiro

    Segata Sanshiro Member

    Joined:
    Feb 19, 2005
    Messages:
    162
    Location:
    Madrid
    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.
     
  5. spaceboygp32x

    spaceboygp32x Member

    Joined:
    Jan 31, 2005
    Messages:
    505
    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: Feb 3, 2016
  6. Segata Sanshiro

    Segata Sanshiro Member

    Joined:
    Feb 19, 2005
    Messages:
    162
    Location:
    Madrid
    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
     
  7. Moogle

    Moogle .

    Joined:
    Apr 27, 2004
    Messages:
    283
    Location:
    Netherlands
    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. :)
     
  8. spaceboygp32x

    spaceboygp32x Member

    Joined:
    Jan 31, 2005
    Messages:
    505
    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: Feb 3, 2016
  9. Moogle

    Moogle .

    Joined:
    Apr 27, 2004
    Messages:
    283
    Location:
    Netherlands
    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.
     
  10. Quiest

    Quiest I like turtles!

    Joined:
    Sep 2, 2004
    Messages:
    3,063
    Location:
    Dteuschland ;)
    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: Feb 3, 2016

Share This Page

Loading...