Jump to content

Czar

Members
  • Content Count

    445
  • Joined

  • Last visited

  • Days Won

    13

Posts posted by Czar

  1. I would like to have a canvas with all the benefits of a game canvas surrounded by HTML elements like, buttons, panels etc.

     

    I making a strategy game which requires lots of buttons, information reports etc so using standard buttons, memo, panel etc would make much easier than remaking them for a canvas.

     

    At the moment I am trying to use a paintbox as an option but it is less than ideal as it doesn't have the benefits afforded by TW3GameView etc. I miss things like the last frame time & frame rate.

     

    Is it possible to combine a Game Canvas with a form? And if so how?

     

    If paintbox is the best solution then what is the best way to ensure it is redrawn often? At the moment I use paintbox1.invalidate after it has finished drawing everything.

  2. Hi all,

     

    I figured out that I can print using

     

    asm

    window.print();

    end;

     

    However, I actually just want to print the contents of an Iframe "W3IFrameHTMLElement1". But I have not been able to get that working. I tried a number of javascript solutions but none worked.

     

     

    e.g,

     

    asm

    document.getElementsByName("W3IFrameHTMLElement1").print();

    end;

  3. ON some computers I have found that my labels, generated in code, are truncated.

     

    e.g., TABLES becomes TABL...

     

    Changing the width and or height of the label does not make a difference.

     

    I have found that taking BOLD off fixes the problem. At a guess I would say the bold is pushing the label beyond some barrier resulting in it being truncated.

     

    Has someone got a solution for me?

     

    I have attached both CSS and the code

     

    .hit-the-floor {

    color: #eee;

    font-weight: bold;

    font-family: Helvetica;

    font-size: 48px;

    text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa,

    0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3),

    0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 10px 10px rgba(0,0,0,.2), 0 10px 10px rgba(0,0,0,.15);

     

    }

     

    TablesLabel := tw3label.Create(ButtonPanel);

    TablesLabel.caption := 'TABLES';

    TablesLabel.left := 0; TablesLabel.top := 00;

    TablesLabel.width := 560; TablesLabel.height := 100; //<= changing these makes no difference

    TablesLabel.aligntext :=taCenter;

    TablesLabel.styleclass := 'hit-the-floor';

  4. They are 3d rendered images - i.e., a 2d sprite sheet. I used 3dMax to render the images. The little dudes represents the limits of my 3d ability :D

     

    The "Dude" has a number of animations, e.g.,walking, falling, spinning captured. The animation just updates the frame after certain amount of milliseconds.

     

    dudeupdown.png

  5. As part of our exploration of SmartMS I decided to convert a very old game that I wrote back in 2002 using DelphiX. No PNGs and the slowest computers were pentium 200mhz. It was interesting to see how we dealt with really old, slow computers to ensure the Dudes did not "fall" through the platform. Those issues don't really exist any more with the speed of current machines and browsers.

     

    With the conversion I literally copied large sections of Delphi code into SmartMS and then adjusted what was required. I also tidied up a few poor programming decisions and improved some of the graphics. Can I get a bit cheer for PNGs? All the images were originally in 8bit Bitmap format with Fuchsia as the transparent colour. We had little tricks to ensure you didn't end up with a Fuchsia tinted fringe.

     

    This game was built using Canvas and used the same framework as the Game Demo at the start of this thread. There are a few problems with the placement of visuals so it may not look right on your browser. I may tidy that up later. Our games are written to be played in approximately 70 seconds. And they must appeal to kids from 5 to 15 years old. Jungle Chaos has been a popular game in our centres for the last 15 years. The total conversion including upgraded visuals, tweaking the game play and solving various programming challenges took approx two and a half working days. Not too bad.

     

    http://numberworksnwords.com/cloud/junglechaos/index.html

     

     

    junglechaos.jpg

  6. Here is a small sample of a more or less finished program. We are currently looking at converting much of our Delphi library to SmartMS.

     

    http://numberworksnwords.com/cloud/zap/index.html

     

    This was converted from Delphi. The Tables screen is simply buttons and labels with CSS.

    The robots are TW3sprites.

     

    There were a few challenges that we had to overcome, nothing too major. It took me a while to realise that to get the sprite-sheet animating correctly the values had to be negative :)

     

     

    zap1.jpg

     

    zap2.jpg

  7. Thanks Dennis that was the clue I was looking for. I expected it to work like findcomponentbyname I didn't realise you could add it to object

     

    panel1.childbyname('lbl1')

     

    I couldn't find a single sample or examples in the RTL of ChildByName being used like this :)

  8. It is probably to my lack of understanding but I would like to find a solution to this problem.

     

    If I create a label like this

     

    ALabel := new Tw3Label(self); // = self being the form

    ALabel.name :='lb'+inttostr(i+1);

     

    then

     

    if assigned(ChildByName('lbl'+inttostr(i))) then

    tw3label(ChildByName('lbl'+inttostr(i))).Caption := QItem.FQuestion;

     

    Works fine.

     

    However, if I change the create to use a panel

    ALabel := new Tw3Label(BackPanel);

     

     

    Then it fails to find ChildByName. The BackPanel is a panel on the form

     

    How do I solves this problem? Where is my logic going wrong?

  9. It is the lack of being able to trust BEDMAS rules which is annoying. I can deal with the work-around but it took me about 30 minutes to figure out it was the equation resulting in 0 that was at fault when I was trying to figure out why the game wasn't working correctly. It should work out that (5 mod 10) first.

  10. I found this problem

     

    w3label1.Caption := inttostr(150*(5 mod 10)); // should be 750 but it results in 0

    w3label2.Caption := inttostr((5 mod 10)*150); // results in 750

     

    They should both result in 750. However, the first one results in 0. I have let Jon know but he didn't think much could be done about it. I thought I would at least post it as a bug so people are aware of it.

  11. I needed a path finding routine for my little Rebelstar game project. I thought I could simply use pathfinding code already written in pascal for the job. This turned out to be more difficult that expected. Hassles with multidimensional dynamic arrays, binary heaps and other oddities that I could easily get working. I finally managed a simple routine working. I don't know who to credit for the original source code as there was no name provided.

     

    The code is provided as is. I do not think that it is very quick. There is no cost for different terrain or diagonals implemented. However, that should not be too hard to add. Also there is no fancy interface to draw walls etc it is just bare bones.

     

    I looked at some of the javascript libraries and they are pretty cool, so if some one wants a challenge. It would be awesome to have a routine that is fed a two dimensional array with rules for walls and costs and a path is returned :)

    pathfinding_SMS.zip

×
×
  • Create New...