Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - arj0n

#2541
To get a clear view of what I'm trying to explain, check the game-demo "Blockz".

This part of code checks, when dragging 'myobject' to the right, if an object called 'oBlockb' is at a certain coordinate [and therefor being in it's way].
If so, 'myobject' [the dragged object] shouldn't move.
It also should let the dragged object only move right when it's X <=360.

Problems:
* If I drag the object really quick it drags through oBlockb instead of being blocked by it.
* If I drag the object really quick it drags through the  <=360 boundary.
* If I drag the object slowly it stops because of "myobject.X+120==oBlockb.X", but then I also can't drag it to the left...

So, how to solve these problems...

And: is there maybe a better way to check if objects are blocking the to-be-dragged "myobject'?

Code: ags

Object* myobject = Object.GetAtScreenXY(mouse.x, mouse.y);
 if (mouse.IsButtonDown(eMouseLeft)) {
    if (button_pressed==0) {
      button_pressed = 1;
      ob = Object.GetAtScreenXY(mouse.x, mouse.y);
    }
  } 
  else {
    button_pressed=0;
    if (ob!=null) {
      //ob.Baseline = 0;   
      ob=null;
    }
  }
  if ((ob != null) && (Game.SpriteWidth[myobject.Graphic]==120) && 
  (myobject.X+120==oBlockb.X &&  myobject.Y-60==oBlockb.Y-60 && myobject.X <=360)){
    int width  = Game.SpriteWidth[ob.Graphic];
    int height = Game.SpriteHeight[ob.Graphic];
  ob.SetPosition(ob.X, ob.Y);}  
  
  else if  ((ob != null) && (Game.SpriteWidth[myobject.Graphic]==120) && 
  (myobject.X+120==oBlockb.X && myobject.Y-60==oBlockb.Y-120 && myobject.X <=360)) {
    int width  = Game.SpriteWidth[ob.Graphic];
    int height = Game.SpriteHeight[ob.Graphic];
  ob.SetPosition(ob.X, ob.Y);}  
    
  else if  (ob != null){
    int width  = Game.SpriteWidth[ob.Graphic];
    int height = Game.SpriteHeight[ob.Graphic];
    ob.SetPosition(mouse.x-width/2, ob.Y); 


Regards,
Arj0n.
#2543
Quote from: Mr. Matti on Sun 15/08/2010 11:20:44
Oh, and it would be nice if a single click on the arrowkeys would let it automatically slide into the goal (if there's nothing in its way of course).
mmhh...
#2544
v1.3 is up.

@Mr. Matti:
Thanx and fixed.

@Tinytim:
It seemed to be a roomload bug. It's fixed now, really  :P.
#2545
How can I change this code so that the object is only drag'n'Dropped left or right?

Code: ags

function room_RepExec()
{
  if (mouse.IsButtonDown(eMouseLeft)) {
    if (button_pressed==0) {
      button_pressed = 1;
      ob = Object.GetAtScreenXY(mouse.x, mouse.y);
    }
  } 
  else {
    button_pressed=0;
    if (ob!=null) {
      ob=null;
    }
  }
  if (ob != null) {
    int width  = Game.SpriteWidth[ob.Graphic];
    int height = Game.SpriteHeight[ob.Graphic];
    ob.SetPosition(mouse.x-width/2, mouse.y+height/2);  
}
}
#2546
Reuploaded v1.2.

@ straydogstrut:
And thanx, level 5 slider bug fixed  ;)
Reuploaded v1.2.
#2547
@ Everyone:
Thanx all for the comments so far.

@ Bicilotti:
A 'click, hold, move mouse, release' way of sliding the blocks was also my idea but then I have to
find out how to do that. I skipped it for this demo because I had no spare time left [job]...
But I think I will try to change the way of moving the blocks into into real sliding.
[if it's not to hard to find a solution for it, I'm still a 'beginner' codewise....

I also like the 'divided in unlockable "worlds" idea.  Uber cool indeed but it will cost me way more time art wise.

@ Radiant:
Fitting background music might be added in the final version.
I hadn't time enough to add music for this little demo...

@Stupod:
A move counter was already an idea but I'm not sure if it will be added in the final version.

#2548
v1.2 is now up  ;D

@Mr. Matti:
The 'White-slider was not blocking the Home/Delete key slider' bug fixed.
Can't repro your 'couldn't move a "page up" upwards' problem in L9... ???
Can you tell me which of the page-up key's had a problem moving up when looking at the begin situation of this level?

@Tinytim:
When finished L12 you can now enter L13

#2549
Level 11 'shift key slider' bug fixed, thanx for noticing Ben  ;)

v1.1 is now up.
#2550


BLOCKZ [Demo]


My first AGS game :D
A sliding puzzle like the classic board game Rush Hour.
This demo contains 13 playable levels.

v1.3:

  • Level 09: 'Pageup/down key slider' bug fixed.
  • Level 13: Room-load bug fixed.
    v1.2:
  • Level 03 'Home/Delete key slider' bug fixed.
  • Level 05 'page up/down key slider'bug fixed.
  • Level 12 'unable to enter level 13' bug fixed.
    v1.1:
  • Level 11 'shift key slider' bug fixed.
Download 'Blockz [Demo]' here

When starting a new level the game will be auto-saved.
When starting an already unlocked level, the game will not save.
When starting the game it will auto-restore the savegame, bringing you to the start of last played level.
A level will be unlocked when you finish it  :P.
You can replay unlocked levels by the level select menu, just click the on-screen star-button.
You can reset a level by using the on-screen circle-with-arrow-button.
Quit the game by clicking the on-screen Q-button.

Shortkey's:
L = Level Select
Q = Quit game

This demo still contains placeholders like for example the mouse pointer.
The next & previous buttons in the level select screen are not yet enabled since there's only one screen yet.

Screens:
Level 2:                                                                            Level select:


Comments please...

Enjoy  ;)
#2551
Very cool module  :)
#2552
Quote from: GarageGothic on Sun 08/08/2010 10:17:15
There's a page in the manual titled "system limits" where you can find that kind of info.
Thanx for the info.
#2553
Can't find it on the forum: is there a max amount of buttons on a gui and if so, what is the amount?
#2554
AGS Games in Production / Re: TROICA
Sat 07/08/2010 23:49:27
Very interesting stuff DN
#2555
@ Nickel:
Die Dulce Fruere does make sense.
It's Latin, meaning "enjoy the day" or "have a nice day".
Not so fascistic after all ;)
#2557
General Discussion / Re: Ported/cloned games
Wed 04/08/2010 12:43:37
@Dual:
Indeed, or from iphone for example.
From any other platform to PC via AGS.
But in stead of porting, i'm also curious if there are any games that are clones from console/iphone games.
#2558
Quote from: Misj' on Wed 04/08/2010 12:24:12
On the other hand, without the source it technically wouldn't be a port (because that term indicates that you adapt the original software to run under a different (hardware) system) but a clone or recreation.
I [obviously] do not have the source so I think you're right saying it would be a clone
But then there can still be issues I guess, like for example 'same level design'.
Maybe a slight difference per level will do?
#2559
Can porting a freeware iphone game to pc give any copyright problems?
#2560
General Discussion / Re: Ported games
Wed 04/08/2010 11:15:06
I think that one is just a "1:1 remake".
SMF spam blocked by CleanTalk