Jump to content

Photo

Bomberman style bomb to be assigned to A button


  • Please log in to reply
20 replies to this topic

#16 NeoMasterZX

NeoMasterZX

    Max Bombing!

  • Members
  • Location:The year 21XX

Posted 01 September 2014 - 07:54 PM

It says there are already constants for these  getting rid of the duplicates then tells me that Pushingffc, Cr_flowers,andsmlinkcollision are still undeclared.



#17 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 01 September 2014 - 09:05 PM

std.zh actually has a function for snapping things to the grid.

//Snaps 'x' to the combo grid
//Equivalent to calling ComboX(ComboAt(x,foo));
int GridX(int x) {
    return (x >> 4) << 4;
}
And of course there's one for y as well.


Wait... GridX/GridY work for combos (and some game pointer objects, so on reflection I guess that GridX(this) would work), but I didn't think you could use them to position an ffc, or a drawline command. I was going to make something much simpler, using either a stretched ffc (line, or bitmap), or a base drawline function, that applies damage to enemies, with the bomb itself an ffc object (to avoid the internal explosion mechanics).

Does GridX centre an object smaller than 16 pixels, or does it map its corner to the grid?

Dear me, MoscowModder, you made a full Bomberman framework for ZC: Purely brilliant.

Edited by ZoriaRPG, 01 September 2014 - 09:20 PM.


#18 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 01 September 2014 - 10:08 PM

All that function does is cut off the first four bits of a number, so it basically just gives the most recent multiple of 16. It doesn't take pointer arguments, so you'll have to set their x and y yourself.

this->X = GridX(this->X);

Something like that.



#19 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 01 September 2014 - 10:38 PM

All that function does is cut off the first four bits of a number, so it basically just gives the most recent multiple of 16. It doesn't take pointer arguments, so you'll have to set their x and y yourself.

this->X = GridX(this->X);
Something like that.

That's the part that confuses me, as with a 16-pixel object, that works; but say that you have a 7-pixel by 9-pixel object, and you snap it to the closest 16-pixel margin. Wouldn't it snap to the top-left corner, anchor?

Also, if the object is larger than 16x16, you'd have similar problems if it anchors based on the edge of the object.

In other words, it's not centred on the core of the grid: I think it;d take a bit more to achieve that, which for draw effects, would be critical, and why i said it could be problematic. I really don't have an application for this at present, as this need is fulfilled, and I don;t see an absolute need in my projects, but I may, at some later date.

I think that finding the centre of a combo square, ont he grid, and then matching the centre of an effect/object/pointer to that, would be an excellent library function, and I may make that.

It'd essentially be GridX(), plus CenterX; or something like that:
 
int centreThisX(int x){
    int snap = GridX(x);
    int loc = CenterX(snap);
    return loc;
}

int centreThisY(int y){
    int snap = GridY(y);
    int loc = CenterY(snap);
    return loc;
}

void centreToGrid(int x, int y, ffc anFFC){
    this->X = centreThisX(this);
    this->Y = centreThisY(this);
}

Edited by ZoriaRPG, 01 September 2014 - 10:49 PM.


#20 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 02 September 2014 - 09:14 AM

Ah, right. Just use the second version I posted. That is changed to have everything it needs added and everything it doesn't need taken out.



#21 NeoMasterZX

NeoMasterZX

    Max Bombing!

  • Members
  • Location:The year 21XX

Posted 02 September 2014 - 03:06 PM

All right I'll try it instead, if it works you'll officially be my scripting hero.

 

How exactly do I set the arguments? just type what I want in or what you said?

 

:shrug:


Edited by NeoMasterZX, 06 September 2014 - 07:52 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users