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.
Messages - hoffa
Pages: 1 ... 15 16 [17] 18 19 ... 21
241
« on: November 07, 2011, 02:23:25 pm »
I've changed the layout and sprites slightly:  Wow, it looks awesome ! I hope this game to be coded fastly, since it looks great !
Yeah, I will have to code like there was no tomorrow if I want to have a playable version tonight. I need to have finished something by midnight and I still have loads to do.
242
« on: November 05, 2011, 12:22:40 pm »
I suppose you put ti.images at the top/bottom of your code. But you could do something like that :
imagesLoaded=false
function on.paint(gc) if not imagesLoaded then gc:drawString("Loading",0,0,"top") loadImages() else --Game displaying end end
function loadImages() img1=image.new("...") imagesLoaded=true end I don't know if this trick would work...
Well all the images are loaded when the game is started (or more precisely, as soon as an instance of the game class is created), and TI's own little loading thingy is good enough. BTW, I added two screenshots, both are from the info windows of two units.
243
« on: November 05, 2011, 10:27:47 am »
do you have to load the images yourself or does the prog do that (if yourself, you can display something before loading it)
What do you mean by "load the images yourself"? What images? I'm only talking about the visual stuff the game is made of.
244
« on: November 05, 2011, 09:22:35 am »
This looks nice, but the memory consumption... >< And it is quite slow to open isn't it ?
Haven't looked at the memory consumption nor have I had any issues with it yet (EDIT: of course if it becomes or is a bigger issue, I'll look into and deal with it). To open it, it takes about two seconds, but it's understandable considering the number of images there are. Oh, and those few seconds won't kill anyone; it's no issue as far as I can see.
245
« on: November 04, 2011, 03:20:20 pm »
Why didn't you used the AW2 sprites? I give you using the animated tileset like a challenge!
Because they are too big and I wanted the user to be able to see the whole map at once.
246
« on: November 04, 2011, 02:05:49 pm »
They indeed look awesome, but I am scared in advance at the .tns size, since these are all TI.Images .... 
Good Luck 
Yes it will be bigger than usual, but I don't feel like settling for a dull white background, especially when I'm targeting it for machine that has a color screen.
247
« on: November 04, 2011, 01:37:03 pm »
I've been working for some time on a game I named "Tactical Wars CX" (CX as in TI-Nspire CX, as it is targeted for colored displays), a two-player turn-based strategy game. Frankly, it is still missing quite a few things and there are stuff that needs to be changed. There is no AI for the moment, and although I cannot promise you anything, I'll see if I can add some sort of AI in a later version (and considering the fact it's a field I find interesting, there might very well be one in the future), as soon as I have dealt with more important issues. You may find it is lacking in features and everything might not be well-balanced, and I fully agree, and as I said earlier, I'm going to work on them later. The first thing each player does is choose his or her military units, and then places those units on the map. Right after the units have been placed, the HQ (that spiky tower you can see on one of the screenshots) needs to be built somewhere. If during the game the HQ is destroyed, the player who destroyed it automatically wins. If all of the soldiers of an army are killed, the remaining army (i.e., player) wins. Each army has a certain morale, and that morale evolves during the game based on different actions and variables. The said morale can affect the amount of damage each unit inflict. Every unit--along with an attack, defense, and range value--also has a certain fatigue- or fuel-level, which both replenish if the unit is let to rest (tanks and helicopters get more fuel thanks to the magical Fuel Fairy™), which affects the range of that unit. Special units ("Spetsnaz Team" or "SAS Team") are not visible by the enemy as long as they do not shoot or are not shot. Just to make it clear, that "0 +0" thing you can see in the primitive HUD on the right, shows how much damage you've done during the game and the amount of damage you did on your last hit. You can download the current version here, but be aware that it's an early version that requires some further developing: Changelog:- 0.2
- Fixed a typo in the code that might have caused issues at the end of a game
- Fixed an issue that caused the game to crash at the end, if the user had returned from the unit selection screen to the menu before playing
- Fixed total damage & previous damage sometimes showing wrong values
- Fixed an issue with Blue special units disappearing when placing them
- Added a simple in-game menu
- Added a proper victory screen
- Added a help screen
- Implemented a proper algorithm that generates a list of cells within a certain range (rather than being hard coded)
- If the player presses the "0" key, circles are drawn around the units for more visibility
- The fuel/fatigue now decreases/increases based on the distance moved
- Changed the attributes of different units for more balance
- The initial available area (on the only map) for placing units has been reduced
- Only one loop is now used to draw the units, rather than two
- Units now face the correct direction when the y-coordinate doesn't change while moving
- After placing the units, the cursor goes to the last unit placed rather than the HQ
- When attacking, only attackable units are drawn over
- If a move or an attack is canceled, the cursor returns to the unit
- Blue units now initially face left
- Some minor code & UI changes
- 0.1
And finally, a few screenshots: (if you're as anal as me about stuff not being aligned perfectly, well every drawn string is actually one pixel too low on the emulator)    If you want to know how to return to the menu after a game, read this: http://ourl.ca/13814/260412
248
« on: October 01, 2011, 07:21:13 pm »
@Levak: thanks, didn't know about that. Changed it.
249
« on: October 01, 2011, 06:59:39 pm »
 I was trying to find a way to know if a key is held down or not (for a Lua CHIP-8 emulator I'm writing, more as a proof of concept than anything else), but as you probably already knew if you've programmed in Lua on the TI-Nspire, there is no way of knowing anything except when a key is first pressed. That is because of the way the TI-Nspire has been made; while most of the keys only send one event signal each time the key is pressed, the tab and arrow keys continuously keep sending those signals after a short delay while holding the key down. What you first want to do is to somewhat be able to know when one of those special keys is pressed down. It won't be as accurate as you might want it to be, but using some timer tricks (to tackle that annoying delay gap before it starts bombarding with events among others) it is possible to implement something of an isDown() function. Here's some fairly simple code that displays "true" when the tab key is held down, it should be pretty self-explanatory (and as you will notice, it isn't that accurate. It might be made slightly more accurate by tuning those interval values): Key = class()
function Key:init(eventInterval, firstEventInterval) self.keyDown = false self.eventInterval = eventInterval or 150 self.firstEventInterval = firstEventInterval or 750 self.time = {firstEvent = 0, lastEvent = 0} end
function Key:keyEvent(timeNow) local timeNow = timeNow or timer.getMilliSecCounter() if not self.keyDown then self.time.firstEvent = timeNow end self.time.lastEvent = timeNow self.keyDown = true end
function Key:isDown(timeNow) local timeNow = timeNow or timer.getMilliSecCounter() self.keyDown = timeNow - self.time.firstEvent < self.firstEventInterval or timeNow - self.time.lastEvent < self.eventInterval return self.keyDown end
function on.tabKey() tab:keyEvent() end
function on.timer() platform.window:invalidate() end
function on.create() timer.start(0.01) end
tab = Key() function on.paint(gc) gc:drawString("Tab key down: " .. tostring(tab:isDown()), 0, 0, "top") end Now to know if a number or character key is pressed down, well, there is no way to do that. But one workaround would be to use the tab key. For example, if you wanted to make it possible for the program to know when a certain key is held down, you'd first have to press that key and then quickly press and hold the tab button. After some coding, we have this: MasterKey = class()
function MasterKey:init(eventInterval, firstEventInterval) self.keyDown = false self.eventInterval = eventInterval or 200 self.firstEventInterval = firstEventInterval or 750 self.time = {firstEvent = 0, lastEvent = 0} end
function MasterKey:keyEvent(timeNow) local timeNow = timeNow or timer.getMilliSecCounter() if not self.keyDown then self.time.firstEvent = timeNow end self.time.lastEvent = timeNow self.keyDown = true end
function MasterKey:updateStatus(timeNow) local timeNow = timeNow or timer.getMilliSecCounter() self.keyDown = timeNow - self.time.firstEvent < self.firstEventInterval or timeNow - self.time.lastEvent < self.eventInterval end
function MasterKey:isDown() return self.keyDown end
Keys = class()
function Keys:init(keys, eventInterval) self.keys = {} for i = 1, #keys do self.keys[keys[i]] = {keyDown = false, timeLastEvent = 0} end self.eventInterval = eventInterval or 200 end
function Keys:keyEvent(key, timeNow) self.keys[nobbc].timeLastEvent = timeNow or timer.getMilliSecCounter() end
function Keys:updateStatus(key, masterKey) if masterKey.keyDown then if not self.keys[nobbc].keyDown and masterKey.time.lastEvent - self.keys[nobbc].timeLastEvent < self.eventInterval then for key, value in pairs(self.keys) do self.keys[nobbc].keyDown = false end self.keys[nobbc].keyDown = true end else self.keys[nobbc].keyDown = false end end
function Keys:isDown(key) return self.keys[nobbc].keyDown end
function on.tabKey() tab:keyEvent() end
function on.charIn(c) if c == "x" then keys:keyEvent("x") elseif c == "y" then keys:keyEvent("y") elseif c == "z" then keys:keyEvent("z") end end
function on.timer() platform.window:invalidate() end
function on.create() timer.start(0.01) end
tab = MasterKey() keys = Keys({"x", "y", "z"}) function on.paint(gc) tab:updateStatus() keys:updateStatus("x", tab) keys:updateStatus("y", tab) keys:updateStatus("z", tab) gc:drawString("'x' key down: " .. tostring(keys:isDown("x")), 0, 0, "top") gc:drawString("'y' key down: " .. tostring(keys:isDown("y")), 0, 20, "top") gc:drawString("'z' key down: " .. tostring(keys:isDown("z")), 0, 40, "top") end The "master key" in that case is the tab key, which tells the program how long a certain key should be held down. Try it out yourself, press tab + [x/y/z] quickly and hold on to tab, you'll see how the values change. It's not perfect but it's as far as I know the best you can do with TI-Nspire Lua. Well that was it, going to bed now!
250
« on: September 19, 2011, 01:07:32 pm »
Being free must be pretty nice. But I believe being homeschooled has its downsides also. For example you miss most of the social aspect of going to school (i.e. making friends is harder, poorer social skills), but I wouldn't be surprised if that wouldn't be a problem for many people. How about higher education? How does a homeschooled person prove a university he is qualified enough to enroll?
251
« on: September 13, 2011, 11:38:42 am »
Hello, I've been working on a pseudo-3D (using ray casting) engine for the TI-Nspire. Chokosta has already made one (actually I got the idea from him), but I want to have a flexible and fast engine that could eventually be used to make some sort of games. Lua on the TI-Nspire is already quite slow, and so I will try and optimize the most critical parts as much as Lua allows it to have a decent rendering frame rate. At the moment I am in the testing phase, trying different techniques of ray casting (namely, using vectors like Lode Vandevenne in his tutorial does, or using angles) as I want to have good and clear code while still being fast. Also for texture mapping I have a few choices, so I'll have to weigh all that and choose the ones that suit the best. As a summary, what I will try to make is an engine that has/is: - A decent rendering frame rate
- Easy-to-use, easily configurable and flexible
- Texture mapping on walls
- Various rendering effects
- Some sort of fog
- Other stuff that I can't remember
As I love splash screens and screenshots in general, here you go:  Ain't much else for now. Let's just hope making this thread will keep me motivated. :*
252
« on: August 19, 2011, 01:21:10 pm »
253
« on: August 19, 2011, 12:20:44 pm »
Hmmm, I don't know how I missed this the first time. Regardless, it looks really epic  Any chance you could upload your library code to pastebin or something like that and give us a link to that sometime soon, because, if it's alright with you, I would really love to implement this in Pacman 
I'll post the current code in less than an hour, got to do some housekeeping and add a few functions.  Pretty cool, I might also try a basic window GUI library like this as well. Also, dragging windows looks rather difficult on the touchpad, maybe you could change instead to holding a button like "ctrl", and pressing 4, 8, 6, or 2 will move the focused window left, up, right or down respectively ? /suggestion
Actually it's not that difficult to move them around. It looked painful because I moved the window so slowly, and that was because of a small issue (if I moved the cursor too fast, it would ungrab the window). It's fixed now and works pretty well:
254
« on: August 19, 2011, 11:41:34 am »
Alright so now I've rewritten a few parts and restructured my code and done other such things. Here's a small example of a program, it should be pretty straightforward: function win_1_f() hyena:drawImage(win_1, hyenaImage, 0, 0) hyena:drawString(win_1, "Hello, hyena!", 0, 50) end
function win_2_f() hyena:drawString(win_2, "LOOK AT THESE GODDAMN ANTS", 0, 0) end
function on.mouseDown(x, y) hyena:mouseDown(x, y) end
function on.mouseUp(x, y) hyena:mouseUp(x, y) end
function on.mouseMove(x, y) hyena:mouseMove(x, y) end
function on.timer() timer.stop() platform.window:invalidate() end
initialized = false function on.paint(gc) if not initialized then hyena = Hyena(gc) win_1 = hyena:createWindow("First window, yay!", 0, 0, 128, 96) win_2 = hyena:createWindow("FEELS GOOD MAN", 80, 40, 100, 100) hyena:setWindowContentFunction(win_1, win_1_f) hyena:setWindowContentFunction(win_2, win_2_f) initialized = true end hyena:drawWindows() timer.start(0.01) end Which gives (it isn't rendered exactly like that on calc, there are a few very minor differences):
255
« on: August 17, 2011, 03:25:49 pm »
Great !
You know, you can use a cursor.set("grab") <-- or something like that, I don't remember exactly when grabbing windows ...
it's all on http://wiki.inspired-lua.org/cursor.set
That's great, didn't know about that. Thanks!
Pages: 1 ... 15 16 [17] 18 19 ... 21
|